# -*- coding: utf-8 -*-
import sys, io, re
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8", errors="replace")
BASE = r"D:\work buddy\2026-11-05-14-15-52"
h = open(BASE + r"\index_main.html", encoding="utf-8", errors="replace").read()
seg = re.search(r"PROGRAMS\s*=\s*\[(.*?)\n\s*\];", h, re.S).group(1)
ids = ["uw-cs-mmath", "uw-stat-mmath", "uw-biostat-mmath", "uw-mdsai", "uw-ds-mmath",
       "brown-cs-scm", "brown-cs-scm-aiml-track"]
found = {}
for b in re.split(r'(?=\bid:")', seg):
    for i in ids:
        if 'id:"' + i + '"' in b:
            found[i] = b.strip()
print("found", len(found), list(found))
for i, b in found.items():
    print("\n=====", i)
    print(b.replace("\n", " ")[:900])
