# -*- 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")

# 看 Applied Languages 页面
body = open("_56_applied-languages-intercultural-studies-ms.html", encoding="utf-8").read()
text = re.sub(r'<[^>]+>', ' ', body)
text = h.unescape(re.sub(r'\s+', ' ', text))
# 找 Program of Study 或 Degree 要求
m = re.search(r'(Program of Study[^\n]{0,2000})', text)
if m: print("POS:", m.group(1)[:1000])
else:
    # 找 credits / hours
    for kw in ["credits","Credit Hours","minimum","Minimum","requirements","Requirements"]:
        m = re.search(r'(' + kw + r'[^\n]{0,300})', text)
        if m: print(kw+":", m.group(1)[:300])
