# -*- coding: utf-8 -*-
import sys, io, re
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace')
p = r"D:\work buddy\2026-11-05-14-15-52\index_main.html"
h = open(p, encoding="utf-8").read()
i = h.index("const PROGRAMS=["); j = h.index("const CATD=[", i)
seg = h[i:j]
pat = re.compile(r'\{id:"([^"]+)"([\s\S]*?)(?=\{id:"|$)', re.M)
def f(block, k):
    m = re.search(rf'{k}:"([^"]*)"', block); return m.group(1) if m else ""
print("total", len(pat.findall(seg)))
for m in pat.finditer(seg):
    bid, body = m.group(1), m.group(2)
    if f(body,"s") != "ucla": continue
    if f(body,"lvl") != "m": continue
    print(f"{bid:34s}|{f(body,'deg'):8s}|{f(body,'en')[:58]:58s}|{f(body,'tui')[:40]}")
