# -*- coding: utf-8 -*-
import re, io, sys, os
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
os.chdir(r"D:\work buddy\2026-11-05-14-15-52")
idx = open("index_main.html", encoding="utf-8").read()
seg = idx[idx.find("const PROGRAMS="):idx.find("const CATD=")]
# 按 {id:"..."} 切
chunks = re.split(r'(?=\{id:")', seg)
nyu = [c for c in chunks if c.startswith('{id:"') and 's:"nyu"' in c]
for c in nyu:
    cn = re.search(r'n:"([^"]+)"', c)
    en = re.search(r'en:"([^"]+)"', c)
    dept = re.search(r'dept:"([^"]+)"', c)
    college = re.search(r'college:"([^"]+)"', c)
    print((cn.group(1) if cn else "")[:22].ljust(22), "|", (en.group(1) if en else "")[:45].ljust(45), "|", (college.group(1) if college else ""))
