# -*- coding: utf-8 -*-
import io, sys, re, html
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
BASE = r"D:\work buddy\2026-11-05-14-15-52"
h = open(BASE + r"_mae_degree.html", encoding="utf-8").read()
body = re.sub(r"<script.*?</script>", " ", h, flags=re.S)
body = re.sub(r"<style.*?</style>", " ", body, flags=re.S)
body = html.unescape(re.sub(r"<[^>]+>", " ", body))
body = re.sub(r"\s+", " ", body).strip()
print("body len", len(body))
print(body[2600:6200])
print("\n=== STEM / credits / capstone / portfolio / RCR / internship / advisor 完整句 ===")
for kw in ["STEM", "30 credits", "15 credits", "Capstone", "Portfolio", "RCR", "Internship", "advisor", "math", "prerequisite", "400", "499"]:
    for m in re.finditer(kw, body, re.I):
        a=max(0,m.start()-90); b=min(len(body),m.end()+130)
        print(f"[{kw}] ...{body[a:b]}...")
        break
