# -*- coding: utf-8 -*-
import 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()
bad = '["unc","Department of City and Regional Planning","Master of City and Regional Planning","城市与区域规划硕士（MCRP）","MCRP","https://catalog.unc.edu/graduate/schools-departments/city-regional-planning/","soc","details/unc-mcrp.html"\n["unc"'
good = '["unc","Department of City and Regional Planning","Master of City and Regional Planning","城市与区域规划硕士（MCRP）","MCRP","https://catalog.unc.edu/graduate/schools-departments/city-regional-planning/","soc","details/unc-mcrp.html"],\n["unc"'

if bad in idx:
    idx = idx.replace(bad, good, 1)
    open("index_main.html", "w", encoding="utf-8").write(idx)
    print("FIXED")
else:
    print("NOT FOUND")
    # debug: find the area
    i = idx.find("unc-mcrp.html")
    print(repr(idx[i-50:i+200]))
