Skip to content

Commit

Permalink
Update EpicInfo.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sffxzzp authored Dec 17, 2024
1 parent dbfbef3 commit faca3be
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions EpicInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,17 @@
res = requests.post('https://graphql.epicgames.com/graphql', json={"query":"query catalogQuery($locale: String, $count: Int, $start: Int, $country: String!, $sortBy: String, $sortDir: String) {Catalog {searchStore(locale: $locale count: $count start: $start country: $country sortBy: $sortBy sortDir: $sortDir ) {elements {namespace urlSlug catalogNs {mappings {mappings {offerId} pageSlug}}} paging {count start total}}}}","variables":{"locale":"en","count":1000,"start":i*1000,"country":"US","sortBy":"lastModifiedDate","sortDir":"DESC"}}, headers={'origin': 'https://epicgames.com'})
res = res.json()
for item in res['data']['Catalog']['searchStore']['elements']:
if item['catalogNs']['mappings'] != None:
if 'catalogNs' in item and item['catalogNs']['mappings'] != None:
for mapping in item['catalogNs']['mappings']:
if mapping['mappings']['offerId'] == None:
if mapping['pageSlug'] == item['urlSlug']:
if item['namespace'] not in namespace:
namespace[item['namespace']] = mapping['pageSlug']
else:
if mapping['pageSlug'] == item['urlSlug']:
if item['namespace'] not in namespace:
namespace[item['namespace']] = mapping['pageSlug']
if mapping['mappings']['offerId'] != None:
if mapping['mappings']['offerId'] not in offerid:
offerid[mapping['mappings']['offerId']] = mapping['pageSlug']

with open('offerid.json', 'w', encoding='utf-8') as f:
f.write(json.dumps(offerid))
f.write(json.dumps(offerid), ensure_ascii=False)

with open('namespace.json', 'w', encoding='utf-8') as f:
f.write(json.dumps(namespace))
f.write(json.dumps(namespace), ensure_ascii=False)

0 comments on commit faca3be

Please sign in to comment.