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

def count(path):
    t=open(path,encoding="utf-8",errors="ignore").read()
    seg=t[t.find("const PROGRAMS="):t.find("const CATD=")] if "const CATD=" in t else t
    p=len(re.findall(r'\{id:"',seg))
    vd=re.search(r'const VERIFIED_DETAILS=new Set\(\[(.*?)\]\);',t,re.S)
    v=len(re.findall(r'"([^"]+)"',vd.group(1))) if vd else -1
    catd=len(re.findall(r'\["',t[t.find("const CATD="):t.find("const VERIFIED_DETAILS=")])) if "const CATD=" in t else -1
    return p,v,catd

for f in [r"publish\美加硕士项目查询库\index_main.html",
          r"publish\美加硕士项目查询库_单文件版_2026-11-18.html",
          r"index_main.html"]:
    if os.path.exists(f):
        p,v,c=count(f)
        import datetime
        mt=datetime.datetime.fromtimestamp(os.path.getmtime(f)).strftime("%Y-%m-%d %H:%M:%S")
        print(f,"PROGRAMS=",p,"VD=",v,"CATD=",c,"mtime=",mt)
