# -*- coding: utf-8 -*-
"""第四十四轮候选探测：Cornell BME / UMich Biostat / Dartmouth MSB / NYU MPA HPM / Cornell Chemistry"""
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

candidates = [
 ("cornell_bme_grad", "https://gradschool.cornell.edu/fields-of-study/biomedical-engineering/"),
 ("cornell_bme_eng", "https://engineering.cornell.edu/me/bme/graduate"),
 ("umich_biostat_rackham", "https://rackham.umich.edu/programs-of-study/biostatistics/"),
 ("umich_biostat_sph", "https://sph.umich.edu/biostat/degree-programs/masters.html"),
 ("dartmouth_msb", "https://graduate.dartmouth.edu/academics/degrees-programs/molecular-and-systems-biology"),
 ("dartmouth_msb_bme", "https://geiselmed.dartmouth.edu/graduates/programs/molecular-and-systems-biology/"),
 ("nyu_mpa_hpm", "https://wagner.nyu.edu/education/graduate-programs/mpa-health-policy-and-management"),
 ("nyu_mpa_pnm", "https://wagner.nyu.edu/education/graduate-programs/mpa-public-and-nonprofit-management-policy"),
 ("cornell_chem_grad", "https://gradschool.cornell.edu/fields-of-study/chemistry/"),
 ("cornell_chem_bulletin", "https://bulletin.arts.cornell.edu/preview_program.php?catoid=24&poid=8186"),
]
for name,url in candidates:
    try:
        req=urllib.request.Request(url,headers={"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"})
        r=urllib.request.urlopen(req,timeout=15,context=ctx)
        b=r.read()
        print(f"{name}: {r.status} {len(b)}B  {url}")
        open(f"_44_{name}.html","wb").write(b)
    except urllib.error.HTTPError as e:
        body=e.read()[:200] if e.fp else b""
        print(f"{name}: HTTP {e.code} {len(body)}B  {url}")
    except Exception as e:
        print(f"{name}: ERR {type(e).__name__} {e}  {url}")
