# -*- 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)
def fetch(name,url):
    req=urllib.request.Request(url,headers={"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"})
    try:
        r=urllib.request.urlopen(req,context=ctx); b=r.read(); t=b.decode("utf-8","ignore")
        open("_14_"+name+".html","w",encoding="utf-8").write(t)
        txt=html.unescape(re.sub(r"<script.*?</script>"," ",t,flags=re.S))
        txt=re.sub(r"<style.*?</style>"," ",txt,flags=re.S)
        txt=re.sub(r"<[^>]+>"," ",txt); txt=re.sub(r"\s+"," ",txt)
        open("_14_"+name+".txt","w",encoding="utf-8").write(txt)
        print(name,r.status,len(b),"txt",len(txt))
    except Exception as e:
        print(name,"ERR",type(e).__name__,str(e)[:60])

fetch("geo-cs","https://grad.georgetown.edu/computer-science/")
fetch("jhu-fin","https://e-catalogue.jhu.edu/business/degrees-certificates/finance-master-science/")
fetch("jhu-baai","https://e-catalogue.jhu.edu/business/degrees-certificates/business-analytics-artificial-intelligence-master-science/")
fetch("geo-bioinfo","https://bioinformatics.georgetown.edu/")
fetch("vandy-biostat","https://www.vanderbilt.edu/biostatistics-graduate/master-of-science/")
