# -*- coding: utf-8 -*-
import re, io, sys, os
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=")]

# 检查这些关键词是否已在 PROGRAMS
for kw in ["Artificial Intelligence", "Computer Science", "Data Science", "Cybersecurity", "Data Analytics", "Applied Biomedical", "Applied Computational", "Applied Physics", "Chemical Biomolecular", "Civil Engineering"]:
    # 找 en 字段
    m = re.findall(r'en:"([^"]*'+kw+r'[^"]*)"', seg, re.I)
    if m:
        print(f"{kw}: ALREADY IN PROGRAMS → {m[:3]}")
    else:
        # 找 n 字段
        m2 = re.findall(r'n:"([^"]*'+kw+r'[^"]*)"', seg, re.I)
        if m2: print(f"{kw}: ALREADY IN PROGRAMS (cn) → {m2[:3]}")
        else: print(f"{kw}: NOT IN PROGRAMS")

# 检查 JHU 已录的 en 列表
print("\n--- JHU en list ---")
jhu_en = re.findall(r'\{id:"jhu[^"]*"[^}]*en:"([^"]*)"', seg)
for e in jhu_en:
    print("  ", e)
