# -*- coding: utf-8 -*-
import re, html, io, sys, os
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
BASE=r"D:\work buddy\2026-11-05-14-15-52"
t=open(os.path.join(BASE,"_dspp_curr.html"),encoding="utf-8").read()
b=html.unescape(re.sub(r"<[^>]+>"," ",re.sub(r"<script.*?</script>|<style.*?</style>"," ",t,flags=re.S)))
b=re.sub(r"\s+"," ",b)
for code in ["5575","5799","5008","5210","5390","5605","5610","5840","5391","5414","5665","5725","5805","5880"]:
    m=re.search(r"PUBPOL\s?"+code+r"[^.]{0,110}",b)
    print(code, "->", m.group(0).strip() if m else "NOT FOUND")
# 季度学分块
for kw in ["Summer Semester","Fall Semester","Winter","Spring Semester","41 Credits","40 Credits"]:
    m=re.search(re.escape(kw)+r"[^.]{0,140}",b)
    if m: print("§",m.group(0).strip())
