Files
free-steam-games-list/scripts/check_dead_links.py
T
poli0981andClaude Opus 5.5 09991874d7 ci(python): run the pipeline, its tests and every data job on Python 3.15
- Sixteen setup-python steps move from '3.12' to '3.15'. codeql.yml alone
  stays on '3.14': CodeQL's supported-languages page lists Python up to 3.14
  and its extractor runs on that interpreter; the pipeline uses no 3.15-only
  syntax.
- The updater-json job of release-desktop.yml sets up 3.15 instead of
  running the runner image's python3.
- Four text-mode writes name encoding="utf-8": the dead-link log, both
  leaderboards and clear_temp(). 3.15 makes UTF-8 the default (PEP 686); on
  Windows an older Python writes cp1252, which cannot encode the
  leaderboards' emoji, so those scripts crashed there. CI already wrote
  UTF-8, so no committed output changes.
- requirements.txt's compile line and sonar.python.version say 3.15.
  `uv pip compile --universal` gives the same lock for 3.12 and 3.15, and
  every pin installs on 3.15 with --require-hashes --only-binary :all:
  (charset-normalizer's cp315 wheels were already hashed).

Checked on Python 3.15.1: the 299 tests pass with EncodingWarning and
DeprecationWarning as errors; edit_game.py --check and delete_game.py
--check pass; a full save_main(load_main()) on a copy of the data leaves all
36 files byte-identical to HEAD, as on 3.14, so no shard and no index.json
changes when the data jobs move.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 10:19:30 +07:00

45 lines
2.0 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
"""Dead link checker – HEAD requests only."""
import sys, os, random, time
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from datetime import datetime, timezone
from core.constants import DEAD_LINKS_LOG, BATCH_SIZE, BATCH_PAUSE_MIN, BATCH_PAUSE_MAX
from core.data_store import load_main, save_main, extract_appid, now_iso, append_note_idempotent
from core.steam_client import get_client
def main():
games = load_main()
active = [g for g in games if g.get("status", "active") == "active"]
print(f"Checking {len(active)} games...\n")
client, dead, total = get_client(), [], len(active)
for bs in range(0, total, BATCH_SIZE):
be = min(bs + BATCH_SIZE, total)
print(f"── Batch {bs//BATCH_SIZE+1} ──")
for i in range(bs, be):
g = active[i]
appid = extract_appid(g.get("link", ""))
if not appid: continue
name = g.get("name", appid)
code = client.check_store_page(appid)
if code in (404, 410):
print(f" [{i+1}/{total}] 💀 {name} ({code})")
g["status"] = "delisted"
append_note_idempotent(g, "💀 Delisted", f"💀 Delisted ({code})")
g["last_updated"] = now_iso()
dead.append({"name": name, "appid": appid, "code": code})
else:
print(f" [{i+1}/{total}] {'✓' if code==200 else f'⚠{code}'} {name[:50]}")
if be < total:
time.sleep(random.uniform(BATCH_PAUSE_MIN, BATCH_PAUSE_MAX))
save_main(games)
if dead:
ts = datetime.now(timezone.utc).strftime("%Y-%m-%d %H:%M UTC")
with open(DEAD_LINKS_LOG, "a", encoding="utf-8") as f:
f.write(f"\n── {ts} ──\n")
for d in dead: f.write(f" [{d['code']}] {d['name']} ({d['appid']})\n")
print(f"\n💀 {len(dead)} dead")
else:
print(f"\n✓ All {total} alive!")
if __name__ == "__main__": main()