-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcrontab.py
31 lines (20 loc) · 880 Bytes
/
crontab.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import json
from steam.client import SteamClient
def main():
"""Generate app info json files"""
client = SteamClient()
client.anonymous_login()
with open('apps.json', 'r', encoding='utf-8') as fp:
app_ids = list(map(lambda app: app['appid'], json.loads(fp.read())))
infos = client.get_product_info(app_ids)['apps']
branches = {}
for app_id in app_ids:
if 'depots' not in infos[app_id] or 'branches' not in infos[app_id]['depots']:
continue
branches[app_id] = infos[app_id]['depots']['branches']
with open(f'AppInfo/{app_id}.json', 'w', encoding='utf-8') as fp:
json.dump(infos[app_id], fp, indent=4, ensure_ascii=False)
with open('branches.json', 'w', encoding='utf-8') as fp:
json.dump(branches, fp, indent=4, ensure_ascii=False)
if __name__ == "__main__":
main()