import json, io, os
BASE = "/data/www/files"
HOST = "https://ggzyjy.sc.gov.cn"
fixed = 0
for fn in ("projects_20260925.json", "curated_0925.json"):
    p = os.path.join(BASE, fn)
    d = json.load(io.open(p, encoding="utf-8"))
    for r in d:
        u = r.get("url", "")
        if u.startswith("/jyxx/"):
            r["url"] = HOST + u
            fixed += 1
    json.dump(d, io.open(p, "w", encoding="utf-8"), ensure_ascii=False, indent=1)
    print(fn, "-> ok")
print("fixed:", fixed)
d = json.load(io.open(os.path.join(BASE, "projects_20260925.json"), encoding="utf-8"))
for r in d:
    print("%02d | %s" % (r["idx"], r["url"][:95]))
