# -*- coding: utf-8 -*-
import re, html, io, sys, os
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
BASE=r"D:\work buddy\2026-11-05-14-15-52"
def body(k):
    t=open(os.path.join(BASE,f"_dspp_{k}.html"),encoding="utf-8").read()
    b=html.unescape(re.sub(r"<[^>]+>"," ",re.sub(r"<script.*?</script>|<style.*?</style>"," ",t,flags=re.S)))
    return re.sub(r"\s+"," ",b)

h=body("home"); a=body("apply")
def ctx(b,kw,before=120,after=320,n=3):
    out=[]
    for m in re.finditer(re.escape(kw),b):
        s=max(0,m.start()-before);e=min(len(b),m.end()+after)
        out.append(b[s:e])
        if len(out)>=n: break
    return out

for kw in ["Class Profile","Target employers","Career-Ready","Who You’ll Learn","cohort","STEM"]:
    print("### HOME",kw)
    for x in ctx(h,kw): print("  -",x)
for kw in ["Statement of Purpose","video interview","Two letters","750","Resume","Transcripts","minimum GPA","Work Experience"]:
    print("### APPLY",kw)
    for x in ctx(a,kw): print("  -",x)
