import re, os, 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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"})
        with urllib.request.urlopen(req, timeout=10, context=ctx) as resp:
            body = resp.read(60000).decode("utf-8","ignore")
            return resp.status, len(body), body
    except urllib.error.HTTPError as e:
        return e.code, 0, ""
    except Exception as e:
        return "ERR", 0, str(e)[:60]

urls = [
 "https://cse.nd.edu/graduate-programs/",
 "https://ee.nd.edu/graduate-programs/",
 "https://graduateschool.nd.edu/admissions/tuition-and-fees/",
 "https://graduateschool.nd.edu/degree-programs/",
 "https://engineering.nd.edu/graduate-programs/",
]
for u in urls:
    st, ln, body = probe(u)
    print(f"{st} {ln}  {u}")
    if st==200 and body:
        m = re.findall(r'https?://[^"\'<>\s]*tuition[^"\'<>\s]*', body)
        if m: print("   tui links:", list(dict.fromkeys(m))[:5])
    print()
