# -*- 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()

new_entries = [
    {
        "id":"usc-msmkt","s":"usc","n":"市场营销硕士","en":"MS Marketing","dept":"Marshall 商学院 Marketing 系","college":"Marshall School of Business","disc":"biz","lvl":"m","deg":"MS","dur":"1.5–2 年（含 STEM Analytics track）","stem":1,"rank":3,
        "test":{"cls":"opt"},"ddl":"","lang":"","tui":"","url":"details/usc-ccfb8b7.html"
    },
    {
        "id":"usc-msei","s":"usc","n":"创业与创新硕士","en":"MS Entrepreneurship and Innovation","dept":"Marshall 商学院 Lloyd Greif 创业研究中心","college":"Marshall School of Business","disc":"biz","lvl":"m","deg":"MS","dur":"1 年全日制在校","stem":0,"rank":0,
        "test":{"cls":""},"ddl":"","lang":"","tui":"","url":"details/usc-caa2bc9.html"
    },
    {
        "id":"usc-msse","s":"usc","n":"社会创业硕士","en":"MS Social Entrepreneurship","dept":"Marshall 商学院 Brittingham Social Enterprise Lab","college":"Marshall School of Business","disc":"biz","lvl":"m","deg":"MS","dur":"1–2 年（27 units）；每年 8 月入学","stem":0,"rank":0,
        "test":{"cls":""},"ddl":"每年 8 月入学","lang":"","tui":"","url":"details/usc-ca6a1e2.html"
    },
    {
        "id":"unc-ling-ma","s":"unc","n":"语言学文学硕士","en":"MA in Linguistics","dept":"语言学系","college":"文理学院","disc":"art","lvl":"m","deg":"MA","dur":"thesis 路径","stem":0,"rank":0,
        "test":{"cls":"notreq"},"ddl":"","lang":"","tui":"","url":"details/unc-linguistics-ms.html"
    },
    {
        "id":"usc-mqcb","s":"usc","n":"定量与计算生物学硕士","en":"MS in Quantitative and Computational Biology","dept":"QCB 系（跨 Bio Sci/BME/Chem/CS/Math/Physics）","college":"Dornsife 文理学院","disc":"sci","lvl":"m","deg":"MS","dur":"","stem":1,"rank":0,
        "test":{"cls":""},"ddl":"","lang":"","tui":"","url":"details/usc-cca84a1.html"
    },
]

def entry(e):
    tcls = e["test"]["cls"]
    return ('{id:"'+e["id"]+'",s:"'+e["s"]+'",n:"'+e["n"]+'",en:"'+e["en"]+'",dept:"'+e["dept"]+'",college:"'+e["college"]+'",disc:"'+e["disc"]+'",lvl:"'+e["lvl"]+'",deg:"'+e["deg"]+'",dur:"'+e["dur"]+'",stem:'+str(e["stem"])+',rank:'+str(e["rank"])+',test:{cls:"'+tcls+'"},ddl:"'+e["ddl"]+'",lang:"'+e["lang"]+'",tui:"'+e["tui"]+'",url:"'+e["url"]+'"},')

anchor = 'url:"details/usc-cf4d6bc.html"},\n];'
assert anchor in idx, "anchor not found"
new_block = "".join(entry(e) for e in new_entries)
idx = idx.replace(anchor, 'url:"details/usc-cf4d6bc.html"},' + new_block + '\n];', 1)

# VD 追加
vd_start = idx.find("const VERIFIED_DETAILS=new Set([")
assert vd_start > 0
vd_end = idx.find("]);", vd_start)
vd_new = ', "details/usc-ccfb8b7.html", "details/usc-caa2bc9.html", "details/usc-ca6a1e2.html", "details/unc-linguistics-ms.html", "details/usc-cca84a1.html"'
idx = idx[:vd_end] + vd_new + idx[vd_end:]

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