import re, os

base = os.path.dirname(os.path.abspath(__file__))
html = open(os.path.join(base, "index_main.html"), encoding="utf-8").read()

ids = [
    "berkeley-biostat-ma", "brown-scm-biostat", "umich-me-mse", "ucsd-mae-ms",
    "umich-robotics-ms", "usc-apmath-ms", "umich-bme-ms", "cornell-mps-aem",
]
blocks = dict(re.findall(r'\{id:"([^"]+)"([\s\S]*?)(?=\{id:"|\n\];)', html))
vd = set(re.findall(r'"(details/[^"]+\.html)"', html))

for pid in ids:
    if pid not in blocks:
        print(f"[MISSING] {pid}")
        continue
    b = blocks[pid]
    def g(k):
        m = re.search(rf'{k}:"([^"]*)"', b)
        return m.group(1) if m else ""
    lvl = re.search(r'lvl:"([^"]*)"', b)
    lvl = lvl.group(1) if lvl else ""
    url = g("url")
    disk = os.path.exists(os.path.join(base, url))
    print(f"{pid} | lvl={lvl} | deg={g('deg')} | n={g('n')} | en={g('en')}")
    print(f"    url={url} | disk={disk} | VD={url in vd}")
