# -*- coding: utf-8 -*-
import io, re, json, collections
P = r"D:\work buddy\2026-11-05-14-15-52\index_main.html"
html = io.open(P, encoding="utf-8").read()
seg = html[html.index("const PROGRAMS=["):html.index("const CATD=[")]
blocks = seg.split('{id:"')[1:]
recs = []
for b in blocks:
    rid = b.split('"', 1)[0]
    m = re.search(r'(?<![A-Za-z])s:"([^"]*)"', b)
    n = re.search(r'(?<![A-Za-z])n:"([^"]*)"', b)
    recs.append((rid, m.group(1) if m else None, n.group(1) if n else ""))
cnt = collections.Counter(r[1] for r in recs)
print("s 值分布:", dict(cnt))
print("总数:", len(recs))
legit = set(cnt.keys()) - {"university", "", None}
bad = [r for r in recs if r[1] in (None, "", "university")]
print("异常条目:")
for r in bad:
    print(" ", r)
io.open("_r368_s_bad.json", "w", encoding="utf-8").write(json.dumps(bad, ensure_ascii=False, indent=1))
