import re, os, sys, io
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
base = os.path.dirname(os.path.abspath(__file__))
html = open(os.path.join(base, 'index_main.html'), encoding='utf-8').read()
m = re.search(r'const PROGRAMS\s*=\s*\[(.*?)\];', html, re.S)
body = m.group(1)
blocks = dict(re.findall(r'\{id:"([^"]+)"([\s\S]*?)(?=\{id:"|$)', body))

def g(rest, key):
    mm = re.search(key+r':"([^"]*)"', rest)
    return mm.group(1) if mm else ''

rows=[]
for tid, rest in blocks.items():
    s=g(rest,'s')
    if s!='gatech': continue
    testm=re.search(r'test:\{cls:"([^"]*)"\}', rest); cls=testm.group(1) if testm else ''
    if cls=='' or cls=='待补':
        rows.append((tid, g(rest,'deg'), g(rest,'college'), g(rest,'n'), g(rest,'url')))

print("gatech 缺 test 条目:", len(rows))
for tid,deg,col,n,url in rows:
    print(f"  {tid} | {deg} | {col} | {n} | {url}")
