# -*- coding: utf-8 -*-
import urllib.request, ssl, sys, io, json
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
SCTX = ssl.create_default_context(); SCTX.check_hostname=False; SCTX.verify_mode=ssl.CERT_NONE
UA = {"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"}
def probe(url):
    try:
        req = urllib.request.Request(url, headers=UA)
        r = urllib.request.urlopen(req, timeout=15, context=SCTX)
        body = r.read()
        return r.status, len(body)
    except Exception as e:
        return "ERR", str(e)[:80]
cands = [
  # NYU GSAS 剩余
  ("nyu-hist", "https://bulletins.nyu.edu/graduate/arts-science/programs/history-ma/"),
  ("nyu-eas",  "https://bulletins.nyu.edu/graduate/arts-science/programs/east-asian-studies-ma/"),
  ("nyu-jir",  "https://bulletins.nyu.edu/graduate/arts-science/programs/journalism-international-relations-ma/"),
  ("nyu-anth", "https://bulletins.nyu.edu/graduate/arts-science/programs/anthropology-ma/"),
  ("nyu-rel",  "https://bulletins.nyu.edu/graduate/arts-science/programs/religion-ma/"),
  ("nyu-ling", "https://bulletins.nyu.edu/graduate/arts-science/programs/linguistics-ma/"),
  # UNC catalog 剩余系页
  ("unc-eng",    "https://catalog.unc.edu/graduate/schools-departments/english/"),
  ("unc-hist",    "https://catalog.unc.edu/graduate/schools-departments/history/"),
  ("unc-anth",    "https://catalog.unc.edu/graduate/schools-departments/anthropology/"),
  ("unc-rel",     "https://catalog.unc.edu/graduate/schools-departments/religion/"),
  ("unc-afr",     "https://catalog.unc.edu/graduate/schools-departments/african-american-africa-diaspora-studies/"),
  ("unc-wgs",     "https://catalog.unc.edu/graduate/schools-departments/womens-gender-sexuality-studies/"),
  ("unc-eng-lit", "https://catalog.unc.edu/graduate/schools-departments/comparative-literature/"),
  # Duke econ 剩余
  ("duke-qfe", "https://econ.duke.edu/masters-programs/degree-programs/quantitative-financial-economics/"),
  ("duke-maecon", "https://econ.duke.edu/masters-programs/degree-programs/ma-economics/"),
]
for tag, url in cands:
    s, b = probe(url)
    print(f"{tag:14s} {s} {b}")
