# -*- coding: utf-8 -*-
import io, sys, os, urllib.request, ssl, html, re
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
urls={
 "geo-applied-econ":"https://grad.georgetown.edu/economics/",
 "geo-fin-econ":"https://econ.georgetown.edu/ms-financial-economics/how-to-apply/",
 "geo-bmb":"https://msbiochemistry.georgetown.edu/",
 "geo-esm":"https://esm.georgetown.edu/",
 "geo-cyber":"https://scs.georgetown.edu/programs/484/master-of-professional-studies-in-cybersecurity-risk-management/",
}
for k,u in urls.items():
    try:
        req=urllib.request.Request(u,headers={"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64)"})
        r=urllib.request.urlopen(req,timeout=20,context=ctx); b=r.read()
        t=b.decode("utf-8","ignore")
        t=html.unescape(re.sub(r"<script.*?</script>","",t,flags=re.S))
        t=re.sub(r"<style.*?</style>","",t,flags=re.S)
        t=re.sub(r"<[^>]+>"," ",t); t=re.sub(r"\s+"," ",t)
        open(f"_16_{k}.txt","w",encoding="utf-8").write(t)
        print(k,r.status,len(t),"chars")
    except Exception as e:
        print(k,"ERR",type(e).__name__,getattr(e,"code",""))
