# -*- coding: utf-8 -*-
import ssl, urllib.request, re, html, io, sys
sys.stdout=io.TextIOWrapper(sys.stdout.buffer,encoding="utf-8")
ctx=ssl.create_default_context(); ctx.check_hostname=False; ctx.verify_mode=ssl.CERT_NONE
def get(u):
    req=urllib.request.Request(u, headers={"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64)"})
    return urllib.request.urlopen(req, timeout=20, context=ctx).read().decode("utf-8","ignore")
def clean(r):
    t=re.sub(r"<script.*?</script>","",r,flags=re.S|re.I); t=re.sub(r"<style.*?</style>","",t,flags=re.S|re.I)
    t=re.sub(r"<[^>]+>"," ",t); t=html.unescape(t); return re.sub(r"\s+"," ",t).strip()
t=clean(get("https://www.cs.cornell.edu/master-science-computer-science/apply"))
for kw in ["Deadline","deadline","December","January","February","March","GRE","TOEFL","IELTS","Duolingo","English","recommendation","Recommendation","Resume","CV","Transcript","Statement","portfolio","prerequisite","Prerequisite","tuition","Tuition","fee","TA","assistantship","fellowship","funding","Funding","GPA","application fee","December 15","December 1"]:
    p=t.find(kw)
    if p>0: print(kw,"@",p,"|",t[p:p+170])
print("\n===TAIL 6000-13351==="); print(t[6000:13351])
