# -*- coding: utf-8 -*-
import io, sys, json
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
d=json.load(open("todo_upgrade.json",encoding="utf-8"))
# 热门优先级：cs, eng, biz, sci, med, soc
order = {"cs":0,"eng":1,"biz":2,"sci":3,"med":4,"soc":5,"art":6,"edu":7}
# 只保留硕士（lvl 从 deg 推断，MS/MA/MEng/MEng/MPS/MSS/MSSc/MSc 等）
def is_master(deg):
    deg=deg.upper()
    return any(k in deg for k in ["MS","MA","MENG","MEng","MPS","MSS","MSC","MPH","MBA","MM","MFA","MLA"]) and "PHD" not in deg and "DR" not in deg
filt=[x for x in d if is_master(x.get("deg",""))]
filt.sort(key=lambda x: order.get(x.get("disc","art"),9))
print("total master todo:", len(filt))
for i,x in enumerate(filt[:35]):
    print(i, x["s"], "|", x["en"][:55], "|", x["deg"], "|", x["disc"], "|", x["det"].split("/")[-1], "|", x["url"][:70])
