# -*- coding: utf-8 -*-
import ssl,urllib.request,re,io,sys
sys.stdout=io.TextIOWrapper(sys.stdout.buffer,encoding="utf-8")
ctx=ssl.create_default_context(); ctx.check_hostname=False; ctx.verify_mode=ssl.CERT_NONE
def head(u):
    try:
        req=urllib.request.Request(u,headers={"User-Agent":"Mozilla/5.0"})
        with urllib.request.urlopen(req,context=ctx,timeout=20) as r:
            b=r.read(); return r.status,len(b),b.decode("utf-8","ignore")
    except Exception as e:
        return None,None,repr(e)
urls=[
 "https://cee.duke.edu/admissions/masters/",
 "https://cee.duke.edu/academics/graduate",
 "https://cee.duke.edu/graduate",
 "https://cee.duke.edu/admissions/masters/degree-requirements",
 "https://cee.duke.edu/academics/masters",
 "https://gradschool.duke.edu/admissions/application-instructions/",
]
for u in urls:
    st,ln,t=head(u)
    print("==",st,ln,u)
    if st==200 and isinstance(t,str):
        txt=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).strip()
        print("  TXT_LEN",len(txt))
        print("  ",txt[:1800])
