# -*- coding: utf-8 -*-
import io, sys, os, urllib.request, ssl, html, re
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
base="https://ischool.illinois.edu/academics/graduate/ms-information-management"
urls={"ischool-apply":base+"/apply","ischool-tui":base+"/tuition-financial-support"}
for k,u in urls.items():
    try:
        req=urllib.request.Request(u,headers={"User-Agent":"Mozilla/5.0"})
        r=urllib.request.urlopen(req,context=ctx,timeout=15); b=r.read(); t=html.unescape(b.decode("utf-8","ignore"))
        txt=re.sub(r"<script.*?</script>","",t,flags=re.S); txt=re.sub(r"<style.*?</style>","",txt,flags=re.S)
        txt=re.sub(r"<[^>]+>"," ",txt); txt=re.sub(r"\s+"," ",txt)
        open(f"_rice13_{k}.txt","w",encoding="utf-8").write(txt)
        print(k,r.status,len(b),"B")
    except Exception as e:
        print(k,"ERR",type(e).__name__,str(e)[:50])
