# -*- coding: utf-8 -*-
import io,sys,re
sys.stdout=io.TextIOWrapper(sys.stdout.buffer,encoding="utf-8")
t=open("_duke_mems_pratt-req.html",encoding="utf-8").read()
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).strip()
def block(anchor, n=520):
    i=txt.find(anchor)
    if i<0:
        print("NOT FOUND",anchor); return
    print("###",anchor); print(txt[i:i+n]); print("="*70)
block("GRE Scores", 700)
block("Recommendations", 700)
block("Interview/Video Introduction", 900)
block("Duolingo is Preferred", 1100)
block("English Language Testing", 400)
# 分数门槛关键词
for kw in ["120","125","130","score","minimum","TOEFL iBT","IELTS score","band"]:
    j=txt.find(kw)
    if j>=0:
        print("KW",kw,"->",txt[max(0,j-80):j+160])
