# -*- coding: utf-8 -*-
import io, sys, os, urllib.request, ssl, socket, re, html
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
os.chdir(r"D:\work buddy\2026-11-05-14-15-52")
ctx=ssl.create_default_context(); ctx.check_hostname=False; ctx.verify_mode=ssl.CERT_NONE
socket.setdefaulttimeout(15)
urls=[
 ("gd-tui","https://analytics.georgetown.edu/admissions-tuition/"),
 ("gd-tui2","https://analytics.georgetown.edu/tuition-and-scholarships/"),
 ("gh-tui","https://healthinformatics.georgetown.edu/admissions/tuition-funding/"),
 ("gh-tui2","https://healthinformatics.georgetown.edu/tuition-funding/"),
]
for tag,u in urls:
    try:
        req=urllib.request.Request(u,headers={"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/120 Safari/537.36"})
        r=urllib.request.urlopen(req,context=ctx); b=r.read(); raw=b.decode("utf-8","ignore")
        txt=re.sub(r"<script[\s\S]*?</script>"," ",raw); txt=re.sub(r"<style[\s\S]*?</style>"," ",txt)
        txt=html.unescape(re.sub(r"<[^>]+>"," ",txt)); txt=re.sub(r"\s+"," ",txt).strip()
        open(f"_15_{tag}.txt","w",encoding="utf-8").write(txt)
        m=re.search(r"\$[\d,]+",txt)
        print(tag,r.status,len(b),"txt",len(txt),"money=",m.group(0) if m else "none")
    except Exception as e:
        print(tag,"ERR",type(e).__name__,str(e)[:60])
