# -*- coding: utf-8 -*-
import io, sys, os, urllib.request, ssl
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
urls=[
 ("MChE","https://ga.rice.edu/programs-study/departments-programs/engineering/chemical-biomolecular-engineering"),
 ("MCEE","https://ga.rice.edu/programs-study/departments-programs/engineering/civil-environmental-engineering"),
 ("MMSNE","https://ga.rice.edu/programs-study/departments-programs/engineering/materials-science-nanoengineering"),
 ("MBE","https://ga.rice.edu/programs-study/departments-programs/engineering/bioengineering"),
 ("MAcc","https://ga.rice.edu/programs-study/departments-programs/business/jesse-h-jones-graduate-school-of-management/accounting"),
 ("MFin","https://ga.rice.edu/programs-study/departments-programs/business/jesse-h-jones-graduate-school-of-management/finance"),
 ("MEEcon","https://ga.rice.edu/programs-study/departments-programs/business/jesse-h-jones-graduate-school-of-management/energy-economics"),
]
for tag,u in urls:
    try:
        req=urllib.request.Request(u,headers={"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/120 Safari/537.36","Accept":"text/html"})
        r=urllib.request.urlopen(req,timeout=15,context=ctx)
        b=r.read(); print(f"{tag:7} {r.status} {len(b)}B {u}")
        open(f"_rice12_{tag}.html","wb").write(b)
    except Exception as e:
        print(f"{tag:7} ERR {type(e).__name__} {getattr(e,'code',getattr(e,'errno',''))} {u}")
