# -*- coding: utf-8 -*-
import io, sys, os, ssl, urllib.request, socket
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
os.chdir(r"D:\work buddy\2026-11-05-14-15-52")
ctx=ssl.create_default_context(); ctx.check_hostname=False; ctx.verify_mode=ssl.CERT_NONE
socket.setdefaulttimeout(12)
UA={"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/120 Safari/537.36"}
cands=[
 ("ut-c0e5352.html","https://www.sgs.utoronto.ca/programs/finance/"),
 ("ut-c5760ab.html","https://www.sgs.utoronto.ca/programs/financial-risk-management/"),
 ("ut-c90d689.html","https://www.sgs.utoronto.ca/programs/management-analytics/"),
 ("ut-c529fb8.html","https://www.sgs.utoronto.ca/programs/economics/"),
 ("ut-c4ca221.html","https://www.sgs.utoronto.ca/programs/biomedical-engineering/"),
]
for base,url in cands:
    try:
        req=urllib.request.Request(url,headers=UA)
        r=urllib.request.urlopen(req,context=ctx,timeout=12)
        b=r.read()
        open("_35_"+base,"wb").write(b)
        print(base, r.status, len(b), r.headers.get("Content-Type",""), "|", url)
    except Exception as e:
        print(base, "ERR", type(e).__name__, str(e)[:100], "|", url)
