import os, re
html = open('index_main.html', encoding='utf-8').read()
m = re.search(r'const VERIFIED_DETAILS=new Set\(\[([\s\S]*?)\]\)', html)
vd = set(re.findall(r'"(details/[^"]+)"', m.group(1)))
pm = re.search(r'const PROGRAMS=\[([\s\S]*?)\n\];', html)
progs_block = pm.group(1)
urls = re.findall(r'url:"(details/[^"]+)"', progs_block)
missing = [u for u in urls if u not in vd]

# Check disk existence
existing = []
for u in missing:
    p = os.path.join('.', u.replace('/', os.sep))
    if os.path.exists(p):
        existing.append(u)
    else:
        print(f'MISSING ON DISK: {u}')
print(f'\nExisting on disk: {len(existing)}/{len(missing)}')
for u in existing:
    sz = os.path.getsize(u.replace('/', os.sep))
    print(f'  OK {u}  ({sz} bytes)')
