# -*- coding: utf-8 -*-
import re, sys, io, urllib.request, ssl
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
hdr={"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"}
u="https://bc.gatech.edu/master-science-building-construction-and-facility-management"
req=urllib.request.Request(u,headers=hdr)
body=urllib.request.urlopen(req,timeout=15,context=ctx).read(300000).decode("utf-8","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)
body=re.sub(r'<[^>]+>',' ',body); body=re.sub(r'&nbsp;',' ',body); body=re.sub(r'&#039;',"'",body); body=re.sub(r'\s+',' ',body)
for m in re.finditer(r'GRE', body):
    a=max(0,m.start()-220); b=min(len(body),m.end()+220)
    print("...",body[a:b],"...\n-----")
