import re, sys, io, urllib.request, ssl
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 probe(url):
    try:
        req = urllib.request.Request(url, headers={"User-Agent":"Mozilla/5.0"})
        with urllib.request.urlopen(req, timeout=12, context=ctx) as resp:
            return resp.status, resp.read().decode("utf-8","ignore")
    except urllib.error.HTTPError as e:
        return e.code, ""
    except Exception as e:
        return "ERR", str(e)[:60]

urls = [
 ("UT-MMPA","https://www.rotman.utoronto.ca/Degrees/MastersPrograms/MMPA"),
 ("UT-MMPA2","https://www.rotman.utoronto.ca/Programs/Master-of-Management-and-Professional-Accounting"),
 ("UT-MMI","https://www.rotman.utoronto.ca/Degrees/MastersPrograms/MMI"),
 ("UT-MMI2","https://www.rotman.utoronto.ca/Programs/Master-of-Management-Innovation"),
 ("UIUC-MSPE","https://economics.illinois.edu/graduate/ms-policy-economics"),
 ("UIUC-MSPE2","https://fao.illinois.edu/tuition/"),
 ("CMU-LE","https://www.cmu.edu/learning-engineering/"),
]
for k,u in urls:
    st, body = probe(u)
    print(f"=== {k} HTTP {st} len {len(body)} ===")
    if st==200 and body:
        txt=re.sub(r'<script[\s\S]*?</script>','',body); txt=re.sub(r'<style[\s\S]*?</style>','',txt)
        txt=re.sub(r'<[^>]+>',' ',txt); txt=re.sub(r'\s+',' ',txt)
        for m in re.finditer(r'[^.]*\$[\d,]+[^.]*\.?', txt):
            s=m.group(0).strip()
            if any(w in s.lower() for w in ["tuition","fee","per","term","credit","total","cost"]):
                print("  $:", s[:150])
    print()
