Spaces:
Paused
Paused
Download sync_list.py from jynxzio5/onlinefix-api: direct link, hf CLI and curl.
- Browser
- Download file 2.18 kB
-
https://huggingface.co/spaces/jynxzio5/onlinefix-api/resolve/main/sync_list.py
- Command line
-
hf download hf://spaces/jynxzio5/onlinefix-api/sync_list.py
-
curl -L -o sync_list.py https://huggingface.co/spaces/jynxzio5/onlinefix-api/resolve/main/sync_list.py
2.18 kB
| import json | |
| import urllib.request | |
| import re | |
| print("Fetching live catalog from HF Space...") | |
| url = "https://jynxzio5-onlinefix-api.hf.space/api/catalog" | |
| data = json.loads(urllib.request.urlopen(url, timeout=60).read()) | |
| catalog = data["data"] | |
| print(f"Got {len(catalog)} total entries") | |
| # Filter: only valid numeric Steam AppIDs | |
| entries = [] | |
| for g in catalog: | |
| app_id = str(g.get("app_id", "")) | |
| if app_id and re.match(r'^\d+$', app_id): | |
| entries.append(g) | |
| print(f"Filtered to {len(entries)} entries with numeric Steam AppIDs") | |
| # Transform to onlinefix-list.json format | |
| output = [] | |
| for g in entries: | |
| app_id = g["app_id"] | |
| name = g["name"] | |
| # Convert image URL: cdn -> shared, add store_item_assets path | |
| if app_id and app_id.isdigit(): | |
| image_url = f"https://shared.akamai.steamstatic.com/store_item_assets/steam/apps/{app_id}/header.jpg" | |
| else: | |
| raw_image = g.get("image_url", "") | |
| if "cdn.akamai.steamstatic.com/steam/apps/" in raw_image: | |
| image_url = raw_image.replace( | |
| "cdn.akamai.steamstatic.com/steam/apps/", | |
| "shared.akamai.steamstatic.com/store_item_assets/steam/apps/" | |
| ) | |
| else: | |
| image_url = raw_image or "https://placehold.co/460x215?text=No+Cover" | |
| output.append({ | |
| "app_id": app_id, | |
| "name": name, | |
| "image_url": image_url, | |
| "downloadUrl": f"https://huggingface.co/datasets/jynxzio5/onlinefix-packs/resolve/main/packs/{app_id}.zip" | |
| }) | |
| # Sort by app_id numeric | |
| output.sort(key=lambda x: int(x["app_id"])) | |
| # Write | |
| target_path = r"C:\Users\motas\OneDrive\Documents\GitHub\Opela Nexus\server\data\onlinefix-list.json" | |
| with open(target_path, "w", encoding="utf-8") as f: | |
| json.dump(output, f, indent=2, ensure_ascii=False) | |
| print(f"Wrote {len(output)} entries to {target_path}") | |
| # Verify | |
| with open(target_path, "r", encoding="utf-8") as f: | |
| written = json.load(f) | |
| print(f"Verified: {len(written)} entries") | |
| print(f"First entry: {written[0]['name']} ({written[0]['app_id']})") | |
| print(f"Last entry: {written[-1]['name']} ({written[-1]['app_id']})") | |