# -*- 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"})
        resp=urllib.request.urlopen(req,context=ctx,timeout=20)
        d=resp.read().decode("utf-8","ignore")
        h=re.sub(r"<script.*?</script>"," ",d,flags=re.S|re.I); h=re.sub(r"<style.*?</style>"," ",h,flags=re.S|re.I)
        t=re.sub(r"<[^>]+>"," ",h); t=re.sub(r"\s+"," ",t)
        return resp.status,len(d),len(t),t[:300]
    except Exception as e:
        return "ERR",type(e).__name__,str(e)[:100],""
for u in ["https://bulletins.nyu.edu/graduate/arts-science/programs/computer-science-courant-ms/",
          "https://bulletins.nyu.edu/graduate/arts-science/programs/data-science-ms/",
          "https://datascience.uchicago.edu/education/masters-programs/ms-in-applied-data-science/"]:
    print("="*20,u); print(get(u))
