#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
from collections import Counter

html = open(r"D:\work buddy\2026-11-05-14-15-52\index_main.html", encoding="utf-8").read()

m = re.search(r"const PROGRAMS=\[", html)
start = m.end()
depth = 0
j = start
while j < len(html):
    if html[j] == "[": depth += 1
    elif html[j] == "]":
        depth -= 1
        if depth == 0: break
    j += 1

block = html[start:j]
recs = re.findall(r'\{id:"[^"]+",s:"([^"]+)"', block)
c = Counter(recs)
print(f"PROGRAMS 总数: {len(recs)}")
print(f"学校数: {len(c)}")
print()
for s, n in sorted(c.items(), key=lambda x: -x[1]):
    print(f"  {s}: {n}")

# 确认新记录
print()
print("=== 新记录确认 ===")
for keyword in ["emory-cs-ms", "emory-ds-ms", "uva-ds-ms", "unc-stats-ds-ms", "ucla-ba-ms"]:
    found = keyword in block
    print(f"  {keyword}: {'✓' if found else '✗'}")
