# -*- coding: utf-8 -*-
import io, sys, os, re, html
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
os.chdir(r"D:\work buddy\2026-11-05-14-15-52")

def load(f):
    b=open(f,"rb").read()
    t=html.unescape(re.sub(r"<script[\s\S]*?</script>|<style[\s\S]*?</style>"," ",b.decode("utf-8","ignore")))
    return re.sub(r"\s+"," ",re.sub(r"<[^>]+>"," ",t))

files=[
 ("cornell-c47af79.html","Cornell BEE MS"),
 ("cornell-c239b95.html","Cornell Chemistry MS"),
 ("dartmouth-chemistry-ms.html","Dartmouth Chemistry MS"),
 ("dartmouth-mathematics-ma.html","Dartmouth Math MA"),
 ("dartmouth-physics-astronomy-ms.html","Dartmouth Physics MS"),
]
for base,label in files:
    t=load("_35_"+base)
    print("====",label,"| bytes",len(t),"====")
    # 找正文关键词
    for kw in ["Master of Science","M.S.","M.A.","MA","graduate","thesis","coursework","credit","required","admission","deadline","GRE","TOEFL","IELTS","tuition","part-time","online","full-time","residential","on-campus","on campus","duration","year","years","PhD","Ph.D.","doctoral"]:
        i=t.lower().find(kw.lower())
        if i>0:
            print(f"  [{kw}] ...{t[max(0,i-60):i+220]}...")
    print()
