# -*- coding: utf-8 -*-
import io, sys, os, re
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
os.chdir(r"D:\work buddy\2026-11-05-14-15-52")
idx=open("index_main.html",encoding="utf-8").read()
seg=idx[idx.find("const PROGRAMS="):idx.find("const CATD=")]
plvl=re.findall(r'lvl:"([^"]+)"',seg)
print("PROGRAMS",len(plvl),"master",plvl.count("m"),"phd",plvl.count("d"))
for pid in ["jhu-ds-mse","jhu-finfe-ms","jhu-hcm-ms","jhu-hfm-mhs","jhu-ahsi-ms"]:
    m=re.search(r'\{id:"'+pid+r'".*',seg,re.S)
    line=m.group(0) if m else "NOT FOUND"
    def g(k):
        mm=re.search(k+r':"([^"]*)"',line); return mm.group(1) if mm else "?"
    stem=re.search(r'stem:(\d)',line); cls=re.search(r'cls:"([^"]*)"',line); url=re.search(r'url:"([^"]+)"',line)
    print(pid,"| disc=",g("disc"),"| deg=",g("deg"),"| stem=",stem.group(1) if stem else "?","| test=",repr(cls.group(1)) if cls else "?","|",url.group(1) if url else "?")
