# -*- coding: utf-8 -*-
import io, sys, os, re
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()

entries = [
    '{id:"nyu-ds",s:"nyu",n:"数据科学硕士（MS）",en:"MS in Data Science",dept:"Center for Data Science",college:"文理学院 GSAS",disc:"cs",lvl:"m",deg:"MS",dur:"1-2年",stem:1,rank:"",test:{cls:""},ddl:"",lang:"",tui:"",url:"details/nyu-c3472a1.html"}',
    '{id:"nyu-chem",s:"nyu",n:"化学硕士（MS）",en:"MS in Chemistry",dept:"Department of Chemistry",college:"文理学院 GSAS",disc:"sci",lvl:"m",deg:"MS",dur:"1-2年（32学分，至少24校内）",stem:1,rank:"",test:{cls:""},ddl:"",lang:"",tui:"",url:"details/nyu-c239b95.html"}',
    '{id:"nyu-skel",s:"nyu",n:"人体骨骼生物学硕士（MS）",en:"MS in Human Skeletal Biology",dept:"Department of Anthropology",college:"文理学院 GSAS",disc:"sci",lvl:"m",deg:"MS",dur:"1-2年（36学分+论文）",stem:1,rank:"",test:{cls:""},ddl:"",lang:"",tui:"",url:"details/nyu-ce522c3.html"}',
    '{id:"nyu-iren",s:"nyu",n:"国际关系硕士（MA）",en:"MA in International Relations",dept:"Department of Politics – International Relations",college:"文理学院 GSAS",disc:"soc",lvl:"m",deg:"MA",dur:"1-2年",stem:0,rank:"",test:{cls:""},ddl:"",lang:"",tui:"",url:"details/nyu-cbbe78d.html"}',
    '{id:"nyu-polish",s:"nyu",n:"政治学硕士（MA）",en:"MA in Politics",dept:"Department of Politics",college:"文理学院 GSAS",disc:"soc",lvl:"m",deg:"MA",dur:"1-2年（36学分+论文+实习研讨）",stem:0,rank:"",test:{cls:""},ddl:"",lang:"",tui:"",url:"details/nyu-c8cf4c5.html"}',
]

anchor = 'url:"details/nyu-ccb0e04.html"}\n];'
assert anchor in idx, "PROGRAMS anchor not found"
new_progs = ",\n" + ",\n".join(entries) + "\n"
idx = idx.replace(anchor, 'url:"details/nyu-ccb0e04.html"},' + new_progs + '];', 1)

vd_dets = ['"details/nyu-c3472a1.html"', '"details/nyu-c239b95.html"', '"details/nyu-ce522c3.html"',
           '"details/nyu-cbbe78d.html"', '"details/nyu-c8cf4c5.html"']
vd_start = idx.find("const VERIFIED_DETAILS=new Set([")
assert vd_start > 0
vd_end = idx.find("]);", vd_start)
assert vd_end > vd_start
insert = ", " + ", ".join(vd_dets)
idx = idx[:vd_end] + insert + idx[vd_end:]

open("index_main.html", "w", encoding="utf-8").write(idx)
print("APPENDED OK")
