# -*- coding: utf-8 -*-
import re, sys, io
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
idx = open(r"D:\work buddy\2026-11-05-14-15-52\index_main.html", encoding="utf-8").read()
seg = idx[idx.find("const PROGRAMS="):idx.find("const CATD=")]
keys = [
    ("CGGT MSE", "Computer Graphics and Game Technology"),
    ("Cybersecurity MSE", "Software Systems and Cybersecurity"),
    ("BioE MSE", "Bioengineering"),
    ("Biotech MBIOT", "Biotechnology"),
    ("Applied Math MA", "Applied Mathematics and Computational Science"),
    ("DS+AI MSE", "Data Science and Artificial Intelligence"),
    ("Sci Comp MSE", "Scientific Computing"),
    ("CS MASC", "Computer Science and Master"),
    ("MCIT", "Computer and Information Technology"),
    ("ESE MSE", "Energy and Sustainability"),
    ("Tech Innovation", "Technology Innovation"),
]
for tag, kw in keys:
    matches = [m.start() for m in re.finditer(re.escape(kw), seg, re.I)]
    up_hits = []
    for m in matches:
        # 找 en 字段
        s = seg[max(0,m-300):m+200]
        if 's:"up"' in s:
            up_hits.append(s)
    print(f"=== {tag} ({kw}) : total {len(matches)}, up-related {len(up_hits)} ===")
    for h in up_hits[:3]:
        print("   ...", h[-260:].replace("\n"," "))
