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 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")

ubc=get("https://www.grad.ubc.ca/prospective-students/graduate-degree-programs")
for m in re.finditer(r'href="([^"]*public-policy[^"]*)"', ubc, re.I):
    print("UBC link:", m.group(1))

jhu=get("https://e-catalogue.jhu.edu/arts-sciences/advanced-academic-programs/programs/geographic-information-systems-master-science/")
for l in dict.fromkeys(re.findall(r'href="([^"]+)"', jhu)):
    if any(k in l.lower() for k in ["tuition","fee","cost","financial","aid"]):
        print("JHU link:", l)
txt=re.sub(r'<script[\s\S]*?</script>','',jhu); txt=re.sub(r'<style[\s\S]*?</style>','',txt)
txt=re.sub(r'<[^>]+>',' ',txt); txt=re.sub(r'\s+',' ',txt)
i=txt.lower().find("tuition")
print("JHU tuition ctx:", txt[i-100:i+200] if i>=0 else "none")
