# -*- coding: utf-8 -*-
import requests, sys, io, re
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8", errors="replace")
H = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0 Safari/537.36",
     "Accept-Language": "en-US,en;q=0.9"}
urls = [
 "https://www.ese.upenn.edu/education/masters/electrical-engineering/",
 "https://www.ese.upenn.edu/education/masters/",
 "https://www.stat.uchicago.edu/",
 "https://stat.uchicago.edu/graduate/",
 "https://www.anderson.ucla.edu/degrees/master-of-quantitative-economics",
 "https://www.anderson.ucla.edu/degrees/master-of-quantitative-economics/curriculum",
 "https://math.ucsd.edu/graduate/ms-program/",
 "https://math.ucsd.edu/graduate/",
 "https://gradschool.cornell.edu/costs-and-funding/tuition-rates/",
 "https://www.gradschool.cornell.edu/costs-and-funding/tuition-rates",
]
for u in urls:
    try:
        r = requests.get(u, headers=H, timeout=20, allow_redirects=True)
        t = re.sub(r"<script.*?</script>|<style.*?</style>", " ", r.text, flags=re.S)
        t = re.sub(r"<[^>]+>", " ", t); t = re.sub(r"\s+", " ", t)
        print(r.status_code, len(t), u, "|", t[:70])
    except Exception as e:
        print("ERR", type(e).__name__, u)
