# -*- coding: utf-8 -*-
import io, sys, re
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
idx=open("index_main.html",encoding="utf-8").read()
catd=idx[idx.find("const CATD="):idx.find("const VERIFIED_DETAILS=")]
# 查 NYU Biostatistics
for kw in ["Biostatistics","biostatistics"]:
    hits=re.findall(r'\[[^\]]*?'+kw+r'[^\]]*?\]',catd)
    print(f"--- CATD 含 [{kw}] ---")
    for h in hits: print(" ",h.strip()[:300])
# 查 PROGRAMS 是否已有
seg=idx[idx.find("const PROGRAMS="):idx.find("const CATD=")]
for kw in ["biostat","Biostat"]:
    hits=re.findall(r'\{id:"[^"]*"[^}]*?'+kw+r'[^}]*?\}',seg,re.I)
    print(f"\n--- PROGRAMS 含 [{kw}] ---")
    for h in hits: print(" ",h.strip()[:300])
