# -*- coding: utf-8 -*-
import io, re, sys
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8", errors="replace")
BASE = r"D:\work buddy\2026-11-05-14-15-52"
h = io.open(BASE + r"\index_main.html", encoding="utf-8").read()
seg = h[h.index("const PROGRAMS=["):h.index("const CATD=[")]
blocks = [x for x in re.split(r'(?=\{id:")', seg) if x.lstrip().startswith('{id:"')]
ids = sys.argv[1:]
for b in blocks:
    bid = re.search(r'id:"([^"]+)"', b).group(1)
    if bid not in ids:
        continue
    print("== " + bid)
    for k in ["n","en","school","deg","dur","ddl","lang","tui","url","test"]:
        m = re.search(r'(?<![A-Za-z])' + k + r':("(?:[^"\\]|\\.)*"|\{[^}]*\})', b)
        print("   ", k, "=", (m.group(1)[:220] if m else "MISSING"))
