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

files = {
    "intl-sec": "_55_international-security-ms.html",
    "mbid": "_55_master-biomedical-innovation-development.html",
    "pmase": "_55_applied-systems-engineering-pmase.html",
    "mred": "_55_master-real-estate-development.html",
    "arch-ms": "_55_architecture-ms.html",
}
for tag, fn in files.items():
    body = open(fn, encoding="utf-8").read()
    # 去标签
    text = re.sub(r'<[^>]+>', ' ', body)
    text = h.unescape(re.sub(r'\s+', ' ', text))
    # 找 Program of Study 段
    m = re.search(r'(Program of Study[^\n]{0,3000})', text)
    if m:
        seg = m.group(1)
        print(f"\n===== {tag} =====")
        print(seg[:1500])
    # 找 Degree 信息
    deg = re.search(r'(Degree[^\n]{0,200})', text)
    if deg: print("  DEG:", deg.group(1)[:200])
