#!/usr/bin/env python3
import re, urllib.parse, os

with open('/data/www/files/yjs-cyl-2026-report.html','r') as f:
    html = f.read()

# 提取所有 file-link 的 href
hrefs = re.findall(r'class="file-link"[^>]*href="([^"]+)"', html)
# 也匹配 href 在前的情况
hrefs2 = re.findall(r'href="([^"]+)"[^>]*class="file-link"', html)
all_hrefs = list(set(hrefs + hrefs2))

print(f"共找到 {len(all_hrefs)} 个不同的文件链接")

ok = 0
miss = 0
for h in all_hrefs:
    decoded = urllib.parse.unquote(h)
    full = '/data/www/files/' + decoded
    if os.path.exists(full):
        ok += 1
    else:
        miss += 1
        print(f"MISS: {decoded}")

print(f"\n验证结果: {ok} 个OK, {miss} 个MISS")
