# -*- 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
def clean(t):
    t=re.sub(r"<script.*?</script>"," ",t,flags=re.S)
    t=re.sub(r"<style.*?</style>"," ",t,flags=re.S)
    t=re.sub(r"<[^>]+>"," ",t); return re.sub(r"\s+"," ",t)

for u in ["https://codas.uchicago.edu/academics/ms-data-science/",
          "https://codas.uchicago.edu/how-to-apply/"]:
    t,n=get(u); print("="*80); print(u,"len=",n)
    if t.startswith("ERR"): print(t); continue
    c=clean(t)
    print(c[1400:4200])
    print("-"*40,"LINKS")
    for h in sorted(set(re.findall(r'href="([^"]+)"',t))):
        if "codas" in h or "uchicago" in h: print("  ",h)
