# -*- coding: utf-8 -*-
import io, sys, os, json, ssl, urllib.request, socket
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
os.chdir(r"D:\work buddy\2026-11-05-14-15-52")
ctx=ssl.create_default_context(); ctx.check_hostname=False; ctx.verify_mode=ssl.CERT_NONE
todo={x["det"]:x for x in json.load(open("todo_upgrade.json",encoding="utf-8"))}
picks=["details/usc-c97fb24.html","details/usc-ce4fd5a.html","details/usc-c32a6e0.html","details/usc-cc9187d.html",
 "details/usc-c568b0a.html","details/usc-c33234d.html","details/usc-cd3e360.html","details/usc-ca8f13a.html",
 "details/usc-c8b9fa7.html","details/usc-ca09c65.html","details/usc-cca84a1.html","details/usc-c79ad6f.html"]
socket.setdefaulttimeout(12)
for det in picks:
    x=todo.get(det)
    if not x: print(det,"NOT IN TODO"); continue
    u=x["url"]; req=urllib.request.Request(u,headers={"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/126.0"})
    try:
        r=urllib.request.urlopen(req,context=ctx); b=r.read(); print(f"{det}  {r.status} {len(b)}B  {x['en'][:34]}")
    except Exception as e:
        print(f"{det}  ERR {type(e).__name__} {str(e)[:40]}  {x['en'][:30]}")
