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

slugs = ["international-affairs-ms","global-development-ms","mcrp","march","biology-ms"]
for s in slugs:
    h = open(f"_52_{s}.html", encoding="utf-8").read()
    h = html.unescape(h)
    m = re.search(r'<main[^>]*>([\s\S]*?)</main>', h)
    if not m:
        m = re.search(r'<div[^>]*id="contentarea"[^>]*>([\s\S]*?)(?:<footer|</body>)', h)
    body = m.group(1) if m else h
    body = re.sub(r'<script[\s\S]*?</script>','',body)
    body = re.sub(r'<style[\s\S]*?</style>','',body)
    body = re.sub(r'<nav[\s\S]*?</nav>','',body)
    txt = re.sub(r'<[^>]+>',' ', body)
    txt = re.sub(r'\s+',' ',txt).strip()
    print("="*80)
    print("SLUG:", s, "LEN:", len(txt))
    print(txt[:3500])
