# -*- coding: utf-8 -*-
import re
h = open(r"D:\work buddy\2026-11-05-14-15-52\index_main.html", "r", encoding="utf-8").read()
m = re.search(r"const PROGRAMS\s*=\s*\[", h)
start = m.end()
depth = 1
i = start
while i < len(h) and depth > 0:
    if h[i] == "[": depth += 1
    elif h[i] == "]": depth -= 1
    i += 1
block = h[start:i-1]
entries = re.findall(r'\{id:"([^"]+)"', block)
# Show all unique school prefixes
prefixes = {}
for e in entries:
    p = e.split("-")[0]
    prefixes[p] = prefixes.get(p, 0) + 1
for p in sorted(prefixes.keys()):
    print(f"  {p:12s}: {prefixes[p]}")
print()
print("Total entries:", len(entries))
print("Unique ids:", len(set(entries)))
