# -*- 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")
for det in ["up-c1fcccb.html","up-c4be16d.html","up-c0a3bf1.html"]:
    b=open("_30_"+det,"rb").read()
    txt=html.unescape(b.decode("utf-8","ignore"))
    plain=re.sub(r"<script[\s\S]*?</script>"," ",txt)
    plain=re.sub(r"<style[\s\S]*?</style>"," ",plain)
    plain=re.sub(r"<[^>]+>"," ",plain); plain=re.sub(r"\s+"," ",plain)
    print("\n==========",det,"len",len(plain))
    for kw in ["course units","CU","thesis","concentration","fifth","five","Mathematics","prerequisite","undergraduate","advisor","degree"]:
        for m in re.finditer(kw,plain):
            seg=plain[max(0,m.start()-70):m.start()+150]
            print("  •",seg.strip()[:210]); break
