# -*- coding: utf-8 -*-
import urllib.request, ssl, sys, io, re, html
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
# UNC Education
u = "https://catalog.unc.edu/graduate/schools-departments/education/"
req = urllib.request.Request(u, headers={"User-Agent":"Mozilla/5.0"})
with urllib.request.urlopen(req, timeout=15, context=SCTX) as r:
    body = r.read().decode("utf-8", errors="ignore")
body = re.sub(r"<script[\s\S]*?</script>", " ", body, flags=re.I)
body = re.sub(r"<style[\s\S]*?</style>", " ", body, flags=re.I)
text = re.sub(r"<[^>]+>", " ", body)
text = html.unescape(text); text = re.sub(r"\s+", " ", text).strip()
# find degree listing
m = re.search(r"Graduate\s+Programs", text, re.I)
if m:
    print(text[m.start():m.start()+2500])
else:
    print(text[:3000])
