# -*- coding: utf-8 -*-
import sys, io, re, pathlib, html as H
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8", errors="replace")
CACHE = pathlib.Path(r"D:\work buddy\2026-11-05-14-15-52\cache")

def txt(x):
    x = re.sub(r"<script.*?</script>", " ", x, flags=re.S|re.I)
    x = re.sub(r"<[^>]+>", " ", x)
    return re.sub(r"\s+", " ", H.unescape(x)).strip()

t = txt((CACHE / "cu-curriculum.html").read_text(encoding="utf-8", errors="ignore"))
codes = re.findall(r"\b(?:NBA|AEM|NRE|HADM|ILR|ECON|CS|MATH|ORIE)\s?\d{4}\b", t)
print("codes:", len(codes), sorted(set(codes))[:40])
i = t.find("Curriculum")
print(t[i:i+2500])
