# -*- coding: utf-8 -*-
import io, sys, os, ssl, urllib.request, urllib.error
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

cands = [
  ("notre-acms", "https://graduateschool.nd.edu/degree-programs/applied-and-computational-mathematics-and-statistics/"),
  ("notre-cse", "https://graduateschool.nd.edu/degree-programs/computer-science-and-engineering/"),
  ("notre-ds", "https://graduateschool.nd.edu/degree-programs/data-science/"),
  ("unc-ads", "https://catalog.unc.edu/graduate/degree-programs/information-and-library-science/information-science-ms/"),
  ("unc-bhi", "https://catalog.unc.edu/graduate/degree-programs/biomedical-and-health-informatics/"),
  ("unc-sads", "https://catalog.unc.edu/graduate/degree-programs/statistics-and-operational-research/statistics-analytics-and-data-science-ms/"),
  ("gatech-stat", "https://catalog.gatech.edu/programs/statistics-ms/"),
]
for name, url in cands:
    try:
        req = urllib.request.Request(url, headers={"User-Agent":"Mozilla/5.0"})
        r = urllib.request.urlopen(req, timeout=20, context=ctx)
        b = r.read()
        open(f"_45_{name}.html","wb").write(b)
        print(f"{name} OK {r.status} {len(b)} {url}")
    except Exception as e:
        print(f"{name} FAIL {type(e).__name__} {e} {url}")
