# -*- coding: utf-8 -*-
import io,sys,ssl,urllib.request,re
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 get(u):
    try:
        req=urllib.request.Request(u,headers={"User-Agent":"Mozilla/5.0"})
        b=urllib.request.urlopen(req,timeout=20,context=ctx).read()
        return b.decode("utf-8","ignore"),len(b)
    except Exception as e:
        return "ERR "+repr(e),0
for u in [
 "https://codas.uchicago.edu/",
 "https://codas.uchicago.edu/academics/ms-in-data-science/",
 "https://codas.uchicago.edu/academics/phd-in-data-science/",
 "https://datascience.uchicago.edu/education/masters-programs/masters-in-applied-ai/",
 "https://datascience.uchicago.edu/education/masters-programs/ms-in-applied-data-science/",
]:
    t,n=get(u)
    print("="*80)
    print(u,"len=",n)
    if t.startswith("ERR"):
        print(t); continue
    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)
    print(txt[:1500])
