Spaces:
Paused
Paused
Download sync_verified.py from jynxzio5/onlinefix-api: direct link, hf CLI and curl.
- Browser
- Download file 2.63 kB
-
https://huggingface.co/spaces/jynxzio5/onlinefix-api/resolve/main/sync_verified.py
- Command line
-
hf download hf://spaces/jynxzio5/onlinefix-api/sync_verified.py
-
curl -L -o sync_verified.py https://huggingface.co/spaces/jynxzio5/onlinefix-api/resolve/main/sync_verified.py
2.63 kB
| import json | |
| import urllib.request | |
| from huggingface_hub import HfApi | |
| print("Fetching onlinefix-api catalog...") | |
| r = urllib.request.urlopen("https://jynxzio5-onlinefix-api.hf.space/api/catalog", timeout=60) | |
| catalog = json.loads(r.read())["data"] | |
| print(f" {len(catalog)} total catalog entries") | |
| print("Fetching uploaded packs from dataset...") | |
| api = HfApi() | |
| items = list(api.list_repo_tree("jynxzio5/onlinefix-packs", repo_type="dataset", path_in_repo="packs")) | |
| uploaded = set() | |
| for item in items: | |
| name = item.path.replace("packs/", "") | |
| if name.endswith(".zip"): | |
| size = getattr(item, "size", 0) or 0 | |
| if size > 50000: # Real extracted fix packs are > 50KB | |
| uploaded.add(name) | |
| print(f" {len(uploaded)} REAL valid .zip packs (>50KB) in dataset") | |
| # Retain ALL games (never drop any game from the catalog!) | |
| output = [] | |
| cat_entries = [] | |
| for g in catalog: | |
| app_id = str(g.get("app_id", "")).strip() | |
| name = g.get("name", "") | |
| url = g.get("url", "") | |
| if app_id == "2806050": | |
| image_url = "https://shared.akamai.steamstatic.com/store_item_assets/steam/apps/2806050/c4569404286b4e8bc5810fbc11282d7b842d4e4a/capsule_231x87.jpg?t=1785367749" | |
| elif app_id and app_id.isdigit(): | |
| image_url = f"https://shared.akamai.steamstatic.com/store_item_assets/steam/apps/{app_id}/header.jpg" | |
| else: | |
| image_url = g.get("image_url") or "https://placehold.co/460x215?text=No+Cover" | |
| zip_name = f"{app_id}.zip" | |
| if zip_name in uploaded: | |
| dl_url = f"https://huggingface.co/datasets/jynxzio5/onlinefix-packs/resolve/main/packs/{app_id}.zip" | |
| else: | |
| dl_url = url or f"https://jynxzio5-onlinefix-api.hf.space/api/download?appid={app_id}" | |
| output.append({ | |
| "app_id": app_id, | |
| "name": name, | |
| "image_url": image_url, | |
| "downloadUrl": dl_url | |
| }) | |
| cat_entries.append({ | |
| "app_id": app_id, | |
| "name": name, | |
| "image_url": image_url, | |
| "url": url, | |
| "last_updated": g.get("last_updated", "") | |
| }) | |
| list_path = r"C:\Users\motas\OneDrive\Documents\GitHub\Opela Nexus\server\data\onlinefix-list.json" | |
| with open(list_path, "w", encoding="utf-8") as f: | |
| json.dump(output, f, indent=2, ensure_ascii=False) | |
| print(f"Wrote onlinefix-list.json: {len(output)} entries") | |
| cat_path = r"C:\Users\motas\OneDrive\Documents\GitHub\Opela Nexus\onlinefix-api\data\catalog.json" | |
| with open(cat_path, "w", encoding="utf-8") as f: | |
| json.dump(cat_entries, f, indent=2, ensure_ascii=False) | |
| print(f"Wrote catalog.json: {len(cat_entries)} entries") | |