# -*- coding: utf-8 -*-
import re, sys, io, pathlib
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8", errors="replace")
BASE = pathlib.Path(r"D:\work buddy\2026-11-05-14-15-52")
html = (BASE / "index_main.html").read_text(encoding="utf-8", errors="ignore")
seg = re.search(r"const PROGRAMS=\[(.*?)\n\];", html, re.S).group(1)
blocks = [b for b in re.split(r'(?=\bid:")', seg) if 'id:"' in b]
targets = ['gatech-cs-ms','gatech-hci-ms','gatech-analytics-ms','gatech-stat-ms','gatech-me-ms',
           'gatech-bioinfo-ms','dartmouth-cs-ms','dartmouth-ms-cs','jhu-msf','cornell-mps-acct','nyu-msacc']
def get(b, k):
    m = re.search(r'\b%s\s*:\s*"([^"]*)"' % k, b)
    return m.group(1) if m else ""
for b in blocks:
    if get(b, "id") in targets:
        print(get(b,"id"), "|", get(b,"s"), "|", get(b,"deg"), "|", get(b,"url"))
        print("   ", b.strip()[:600].replace("\n", " "))
