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 get(url):
    req = urllib.request.Request(url, headers={"User-Agent":"Mozilla/5.0"})
    with urllib.request.urlopen(req, timeout=12, context=ctx) as resp:
        return resp.read().decode("utf-8","ignore")

u="https://graduateschool.nd.edu/degree-programs/"
body=get(u)
# 找 cse / electrical / computer / mathematics 项目链接
links = re.findall(r'href="([^"]+)"[^>]*>([^<]*(?:Computer|Electrical|Mathematics|Engineering|Applied)[^<]*)', body, re.I)
for href, txt in links[:30]:
    print(href, "|", txt.strip()[:60])
print("=== tuition 字样 ===")
for m in re.findall(r'[^>\n]*(?:tuition|cost|fee|per credit|per year)[^<\n]*', body, re.I)[:20]:
    print("  ", m.strip()[:100])
