┌─ nix/apps/challenge-mode-leaderboard.nix ──────────────────────────────────┐
│ diff --git a/nix/apps/challenge-mode-leaderboard.nix b/nix/apps/challenge-mode-lea │
│ derboard.nix │
│ index 8c941d2..528214d 100644 │
│ --- a/nix/apps/challenge-mode-leaderboard.nix │
│ +++ b/nix/apps/challenge-mode-leaderboard.nix │
│ @@ -30,55 +30,25 @@ │
│ text = re.sub(r'[\s\'\W]+', '-', text) │
│ return text.strip('-') │
│ │
│ - def get_current_period_and_dungeons(realm_info, session): │
│ - # fetch the current period ID and dungeon list │
│ - region, realm_id, name = realm_info['region'], realm_info['id'], realm_ │
│ info['name'] │
│ - namespace = f"dynamic-classic-{region}" │
│ - url = ( │
│ - f"https://{region}.api.blizzard.com/data/wow/connected-realm/" │
│ - f"{realm_id}/mythic-leaderboard/index?namespace={namespace}" │
│ - ) │
│ - │
│ - try: │
│ - print(f" Fetching leaderboard index for {name}...") │
│ - response = session.get(url, timeout=15) │
│ - response.raise_for_status() │
│ - data = response.json() │
│ - │
│ - href = data["current_leaderboards"][0]["key"]["href"] │
│ - match = re.search(r"/period/(\d+)", href) │
│ - if not match: │
│ - print(f" ERROR: Could not parse period ID for {name}.", file=s │
│ ys.stderr) │
│ - return None, None │
│ - period_id = match.group(1) │
│ - │
│ - dungeons = [] │
│ - for d in data["current_leaderboards"]: │
│ - dungeon_name_field = d["name"] │
│ - # check if the name field is a dictionary of localizations │
│ - if isinstance(dungeon_name_field, dict): │
│ - # if it is, pick the English name for consistency. │
│ - # use .get() for safety in case en_US is missing. │
│ - name_str = dungeon_name_field.get("en_US", "unknown-dungeon │
│ -name") │
│ - else: │
│ - # otherwise, it's already a string. │
│ - name_str = dungeon_name_field │
│ - │
│ - dungeons.append({ │
│ - "id": d["id"], │
│ - "name": name_str, # use extracted string name │
│ - "slug": slugify(name_str) │
│ - }) │
│ - │
│ - print(f" Found Period: {period_id}, Dungeons: {len(dungeons)}") │
│ - return period_id, dungeons │
│ - │
│ - except requests.exceptions.RequestException as e: │
│ - print(f" ERROR: API request failed for {name}: {e}", file=sys.stde │
│ rr) │
│ - return None, None │
│ - except (KeyError, IndexError) as e: │
│ - print(f" ERROR: Could not parse index for {name}. Details: {e}", f │
│ ile=sys.stderr) │
│ - return None, None │
│ + def get_hardcoded_period_and_dungeons(): │
│ + # hardcoded values since the index endpoint is broken │
│ + # all records are now in period 1025 │
│ + period_id = "1025" │
│ + │
│ + dungeons = [ │
│ + {"id": 2, "name": "Temple of the Jade Serpent", "slug": "temple-of- │
│ the-jade-serpent"}, │
│ + {"id": 56, "name": "Stormstout Brewery", "slug": "stormstout-brewer │
│ y"}, │
│ + {"id": 57, "name": "Gate of the Setting Sun", "slug": "gate-of-the- │
│ setting-sun"}, │
│ + {"id": 58, "name": "Shado-Pan Monastery", "slug": "shado-pan-monast │
│ ery"}, │
│ + {"id": 59, "name": "Siege of Niuzao Temple", "slug": "siege-of-niuz │
│ ao-temple"}, │
│ + {"id": 60, "name": "Mogu'shan Palace", "slug": "mogu-shan-palace"}, │
│ + {"id": 76, "name": "Scholomance", "slug": "scholomance"}, │
│ + {"id": 77, "name": "Scarlet Halls", "slug": "scarlet-halls"}, │
│ + {"id": 78, "name": "Scarlet Monastery", "slug": "scarlet-monastery" │
│ } │
│ + ] │
│ + │
│ + print(f" Using hardcoded Period: {period_id}, Dungeons: {len(dungeons) │
│ }") │
│ + return period_id, dungeons │
│ │
│ │
│ def get_leaderboard_data(realm_info, dungeon, period_id, session): │
│ @@ -176,12 +146,7 @@ │
│ f"({realm_info['region'].upper()})" │
│ ) │
│ │
│ - period_id, dungeons = get_current_period_and_dungeons( │
│ - realm_info, session │
│ - ) │
│ - if not period_id or not dungeons: │
│ - print(f" Skipping realm {realm_info['name']}.") │
│ - continue │
│ + period_id, dungeons = get_hardcoded_period_and_dungeons() │
│ │
│ for dungeon in dungeons: │
│ print(f" - Fetching dungeon: {dungeon['name']}") │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ ...hallenge-mode-leaderboard.nix ───┐
│ diff --git a/nix/apps/challenge-mode-leaderb │
│ oard.nix b/nix/apps/challenge-mode-leaderboa │
│ rd.nix │
│ index 8c941d2..528214d 100644 │
│ --- a/nix/apps/challenge-mode-leaderboard.ni │
│ x │
│ +++ b/nix/apps/challenge-mode-leaderboard.ni │
│ x │
│ @@ -30,55 +30,25 @@ │
│ text = re.sub(r'[\s\'\W]+', '-', │
│ text) │
│ return text.strip('-') │
│ │
│ - def get_current_period_and_dungeons(r │
│ ealm_info, session): │
│ - # fetch the current period ID and │
│ dungeon list │
│ - region, realm_id, name = realm_in │
│ fo['region'], realm_info['id'], realm_info[' │
│ name'] │
│ - namespace = f"dynamic-classic-{re │
│ gion}" │
│ - url = ( │
│ - f"https://{region}.api.blizza │
│ rd.com/data/wow/connected-realm/" │
│ - f"{realm_id}/mythic-leaderboa │
│ rd/index?namespace={namespace}" │
│ - ) │
│ - │
│ - try: │
│ - print(f" Fetching leaderboar │
│ d index for {name}...") │
│ - response = session.get(url, t │
│ imeout=15) │
│ - response.raise_for_status() │
│ - data = response.json() │
│ - │
│ - href = data["current_leaderbo │
│ ards"][0]["key"]["href"] │
│ - match = re.search(r"/period/( │
│ \d+)", href) │
│ - if not match: │
│ - print(f" ERROR: Could no │
│ t parse period ID for {name}.", file=sys.std │
│ err) │
│ - return None, None │
│ - period_id = match.group(1) │
│ - │
│ - dungeons = [] │
│ - for d in data["current_leader │
│ boards"]: │
│ - dungeon_name_field = d["n │
│ ame"] │
│ - # check if the name field │
│ is a dictionary of localizations │
│ - if isinstance(dungeon_nam │
│ e_field, dict): │
│ - # if it is, pick the │
│ English name for consistency. │
│ - # use .get() for safe │
│ ty in case en_US is missing. │
│ - name_str = dungeon_na │
│ me_field.get("en_US", "unknown-dungeon-name" │
│ ) │
│ - else: │
│ - # otherwise, it's alr │
│ eady a string. │
│ - name_str = dungeon_na │
│ me_field │
│ - │
│ - dungeons.append({ │
│ - "id": d["id"], │
│ - "name": name_str, # u │
│ se extracted string name │
│ - "slug": slugify(name_ │
│ str) │
│ - }) │
│ - │
│ - print(f" Found Period: {peri │
│ od_id}, Dungeons: {len(dungeons)}") │
│ - return period_id, dungeons │
│ - │
│ - except requests.exceptions.Reques │
│ tException as e: │
│ - print(f" ERROR: API request │
│ failed for {name}: {e}", file=sys.stderr) │
│ - return None, None │
│ - except (KeyError, IndexError) as │
│ e: │
│ - print(f" ERROR: Could not pa │
│ rse index for {name}. Details: {e}", file=sy │
│ s.stderr) │
│ - return None, None │
│ + def get_hardcoded_period_and_dungeons │
│ (): │
│ + # hardcoded values since the inde │
│ x endpoint is broken │
│ + # all records are now in period 1 │
│ 025 │
│ + period_id = "1025" │
│ + │
│ + dungeons = [ │
│ + {"id": 2, "name": "Temple of │
│ the Jade Serpent", "slug": "temple-of-the-ja │
│ de-serpent"}, │
│ + {"id": 56, "name": "Stormstou │
│ t Brewery", "slug": "stormstout-brewery"}, │
│ + {"id": 57, "name": "Gate of t │
│ he Setting Sun", "slug": "gate-of-the-settin │
│ g-sun"}, │
│ + {"id": 58, "name": "Shado-Pan │
│ Monastery", "slug": "shado-pan-monastery"}, │
│ + {"id": 59, "name": "Siege of │
│ Niuzao Temple", "slug": "siege-of-niuzao-tem │
│ ple"}, │
│ + {"id": 60, "name": "Mogu'shan │
│ Palace", "slug": "mogu-shan-palace"}, │
│ + {"id": 76, "name": "Scholoman │
│ ce", "slug": "scholomance"}, │
│ + {"id": 77, "name": "Scarlet H │
│ alls", "slug": "scarlet-halls"}, │
│ + {"id": 78, "name": "Scarlet M │
│ onastery", "slug": "scarlet-monastery"} │
│ + ] │
│ + │
│ + print(f" Using hardcoded Period: │
│ {period_id}, Dungeons: {len(dungeons)}") │
│ + return period_id, dungeons │
│ │
│ │
│ def get_leaderboard_data(realm_info, │
│ dungeon, period_id, session): │
│ @@ -176,12 +146,7 @@ │
│ f"({realm_info['region']. │
│ upper()})" │
│ ) │
│ │
│ - period_id, dungeons = get_cur │
│ rent_period_and_dungeons( │
│ - realm_info, session │
│ - ) │
│ - if not period_id or not dunge │
│ ons: │
│ - print(f" Skipping realm │
│ {realm_info['name']}.") │
│ - continue │
│ + period_id, dungeons = get_har │
│ dcoded_period_and_dungeons() │
│ │
│ for dungeon in dungeons: │
│ print(f" - Fetching dung │
│ eon: {dungeon['name']}") │
└──────────────────────────────────────────────┘