# -*- coding: utf-8 -*-
import io, sys, os, re, json, urllib.request, ssl, time
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
os.chdir(r"D:\work buddy\2026-11-05-14-15-52")
t=open("index_main.html",encoding="utf-8").read()
s=t[t.find("const PROGRAMS="):t.find("const CATD=")]
for nid in ["uw-meng-mme-coop","uw-meng-cheme-coop","uw-compmath-mmath-coop"]:
    print(nid, "IN" if ('{id:"'+nid+'"') in s else "free")

todo=json.load(open("todo_upgrade.json",encoding="utf-8"))
print("\ntodo 条目类型:", type(todo), "len", len(todo) if hasattr(todo,"__len__") else "?")
items = todo if isinstance(todo,list) else todo.get("items") or todo.get("todos") or []
for it in items:
    nm=(it.get("en") or it.get("n") or "")
    det=(it.get("det") or "")
    if any(k in nm.lower() for k in ["engineering sciences","personalized medicine","aerospace","interdisciplinary mathematics","civil","environmental"]):
        print(it.get("s"),"|",nm,"|",it.get("deg"),"|",det,"|",it.get("url"))
