mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 06:12:53 +08:00
commit
164f6af30c
@ -13,6 +13,8 @@ from configs.config import NICKNAME
|
|||||||
# 方法参考:RSSHub /epicgames 路由
|
# 方法参考:RSSHub /epicgames 路由
|
||||||
# https://github.com/DIYgod/RSSHub/blob/master/lib/routes/epicgames/index.js
|
# https://github.com/DIYgod/RSSHub/blob/master/lib/routes/epicgames/index.js
|
||||||
async def get_epic_game():
|
async def get_epic_game():
|
||||||
|
# 现在没用 graphql 辣
|
||||||
|
""" prv_graphql Code
|
||||||
epic_url = "https://www.epicgames.com/store/backend/graphql-proxy"
|
epic_url = "https://www.epicgames.com/store/backend/graphql-proxy"
|
||||||
headers = {
|
headers = {
|
||||||
"Referer": "https://www.epicgames.com/store/zh-CN/",
|
"Referer": "https://www.epicgames.com/store/zh-CN/",
|
||||||
@ -31,10 +33,18 @@ async def get_epic_game():
|
|||||||
"withPrice": True,
|
"withPrice": True,
|
||||||
"withPromotions": True,
|
"withPromotions": True,
|
||||||
},
|
},
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
|
||||||
|
epic_url = "https://store-site-backend-static-ipv4.ak.epicgames.com/freeGamesPromotions?locale=zh-CN&country=CN&allowCountries=CN"
|
||||||
|
headers = {
|
||||||
|
"Referer": "https://www.epicgames.com/store/zh-CN/",
|
||||||
|
"Content-Type": "application/json; charset=utf-8",
|
||||||
|
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.80 Safari/537.36"
|
||||||
}
|
}
|
||||||
async with AsyncClient(headers=headers) as client:
|
async with AsyncClient(headers=headers) as client:
|
||||||
try:
|
try:
|
||||||
res = await client.post(epic_url, json=data, timeout=10.0)
|
res = await client.get(epic_url, timeout=10.0)
|
||||||
res_json = res.json()
|
res_json = res.json()
|
||||||
games = res_json["data"]["Catalog"]["searchStore"]["elements"]
|
games = res_json["data"]["Catalog"]["searchStore"]["elements"]
|
||||||
return games
|
return games
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user