# -*- coding: utf-8 -*-
import io,sys,os,json,re
sys.stdout=io.TextIOWrapper(sys.stdout.buffer,encoding="utf-8")
b=r"D:\work buddy\2026-11-05-14-15-52"
r=open(os.path.join(b,"index_main.html"),encoding="utf-8").read()
# 已入库 PROGRAMS：s + en
done=set()
for m in re.finditer(r'\{id:"([^"]*)",s:"([^"]*)",n:"([^"]*)",en:"([^"]*)"',r):
    done.add((m.group(2),m.group(4).strip().lower()))
todo=json.load(open(os.path.join(b,"todo_upgrade.json"),encoding="utf-8"))
print("todo 总数:",len(todo))
targets=["cornell","duke","dartmouth","emory","vanderbilt","rice","notre","uva","unc","geo","wustl","brown","cmu"]
for t in todo:
    s=t.get("s"); deg=t.get("deg","")
    if s not in targets: continue
    if "PhD" in deg or "Ph.D" in deg: continue
    en=t.get("en","").strip().lower()
    if (s,en) in done: continue
    print(f"{s:11} {deg:5} {t.get('disc',''):4} {t.get('en','')[:52]:52} | {t.get('det','')}")
