# -*- coding: utf-8 -*-
import io, sys, re, os
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
BASE = r"D:\work buddy\2026-11-05-14-15-52"
html = open(os.path.join(BASE, "_hds_page.html"), encoding="utf-8").read()
body = re.sub(r"<script.*?</script>", " ", html, flags=re.S)
body = re.sub(r"<style.*?</style>", " ", body, flags=re.S)
text = re.sub(r"<[^>]+>", " ", body)
text = re.sub(r"\s+", " ", text).strip()
print("=== 正文 3500 之后 ===")
print(text[3500:])
print("\n=== 关键词命中 ===")
for kw in ["deadline", "Deadline", "GRE", "TOEFL", "IELTS", "Duolingo", "tuition", "Tuition", "credit", "Credit", "residency", "Residency", "GPA", "prerequisite", "Prerequisite", "thesis", "Capstone", "STEM", "full-time", "part-time", "application fee", "recommendation", "transcript", "statement"]:
    for m in re.finditer(kw, text):
        i = m.start()
        print(f"[{kw}] …{text[max(0,i-60):i+120]}…")
        break
