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

for fn in ["_46_gatech-ms-or.html","_46_gatech-ms-hs.html","_46_gatech-ms-qcf.html","_46_gatech-ms-ie.html","_46_gatech-ms-sce.html"]:
    print("="*60)
    print(fn)
    h = open(fn,encoding="utf-8",errors="ignore").read()
    t = re.sub(r"<script[\s\S]*?</script>","",h)
    t = re.sub(r"<style[\s\S]*?</style>","",t)
    t = re.sub(r"<[^>]+>"," ",t)
    t = html.unescape(t)
    t = re.sub(r"\s+"," ",t).strip()
    m = re.search(r"Master of Science in [^|]{0,80}", t)
    if m: print("TITLE:", m.group(0)[:120])
    for kw in ["credit hours","Program of Study","Core Courses","STEM","Online","Professional","Residency","Thesis","Non-Thesis","requires","hours of coursework","Practicum","Capstone","track","Track"]:
        i = t.find(kw)
        if i>=0:
            print(f"  [{kw}] {t[max(0,i-20):i+260]}")
            print()
