# -*- coding: utf-8 -*-
import sys, io, re, pathlib, html as H
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8", errors="replace")
CACHE = pathlib.Path(r"D:\work buddy\2026-11-05-14-15-52\cache")

def txt(x):
    x = re.sub(r"<[^>]+>", " ", x)
    return re.sub(r"\s+", " ", H.unescape(x)).strip()

for k in ["gatech-cs", "gatech-analytics", "gatech-stat", "gatech-me", "gatech-bioinfo", "gatech-hci"]:
    t = txt((CACHE / (k + ".html")).read_text(encoding="utf-8", errors="ignore"))
    print("=" * 16, k)
    for kw in ["application deadline", "Deadline", "deadline is", "January 1", "February 1", "December 1", "March 1"]:
        idxs = [m.start() for m in re.finditer(kw, t, re.I)]
        for ix in idxs[:2]:
            print("  ", kw, "->", t[max(0, ix - 350):ix + 350])
