# -*- coding: utf-8 -*-
import sys, io, pathlib, requests, concurrent.futures as cf
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8", errors="replace")
BASE = pathlib.Path(r"D:\work buddy\2026-11-05-14-15-52"); CACHE = BASE / "cache"
UA = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0 Safari/537.36"}
urls = {
 "gt-calendar": "https://registrar.gatech.edu/calendar/",
 "gt-robo-site": "https://robotics.gatech.edu/",
 "gt-robo-adm": "https://robotics.gatech.edu/admissions/",
 "gt-bme-site": "https://bme.gatech.edu/bme/graduate-programs",
 "gt-bioe-site": "https://bioengineering.gatech.edu/",
 "gt-biology-grad": "https://biosciences.gatech.edu/graduate-program",
 "gt-medphys-site": "https://nre.gatech.edu/medical-physics",
 "gt-scheller-ms": "https://scheller.gatech.edu/ms-management",
 "gt-bc-site": "https://bc.gatech.edu/",
 "gt-econ-grad": "https://econ.gatech.edu/graduate",
}
def fetch(k, u):
    try:
        r = requests.get(u, headers=UA, timeout=25, allow_redirects=True)
        (CACHE / (k + ".html")).write_text(r.text, encoding="utf-8", errors="ignore")
        return k, r.status_code, len(r.text), r.url[:95]
    except Exception as e:
        return k, "ERR", str(e)[:70], ""
with cf.ThreadPoolExecutor(8) as ex:
    for res in ex.map(lambda kv: fetch(*kv), urls.items()):
        print(res)
