"""Live-probe candidate 'today open servers' endpoints with the REAL token from MySQL. The old pc-api.996hezi.com/box/v1/getTodayOpen 404s. Candidates from the captures + app.asar JS endpoint map (box/v1 prefix seen on api.996hezi.com). """ import asyncio import sys from pathlib import Path _HERE = Path(__file__).resolve().parent sys.path.insert(0, str(_HERE.parent / "src")) from cq2_sdk.env_loader import load_env load_env(_HERE.parent / ".env") from cq2_sdk.login import Box996Login, ManualGeetestSolver from cq2_sdk.login.box_996 import Box996Error from cq2_sdk.store import UserStore, connection # (host, path, note) CANDIDATES = [ ("https://pc-api.996hezi.com", "/box/v1/getTodayOpen", "old SDK endpoint (404 confirmed)"), ("https://api.996hezi.com", "/box/v1/getTodayOpen", "same path, api host"), ("https://api.996hezi.com", "/box/v2/getTodayOpen", "v2"), ("https://pc-api.996hezi.com", "/v1/homeapi/Gameindex/getTodayOpen", "gameindex style"), ("https://api.996hezi.com", "/authApi/box/v1/getTodayOpen", "authApi prefix host api"), ] async def main() -> int: with connection() as conn: u = UserStore(conn).get_by_username("longwu988") if not u or not u.token: print("FAIL: no real token in MySQL") return 1 token = u.token print(f"token: {token[:30]}...\n") box = Box996Login(geetest=ManualGeetestSolver(), device_id="00:15:5d:0a:04:00") box.token = token for host, path, note in CANDIDATES: label = f"{host.replace('https://', '')}{path}" try: r = await box._request("GET", host, path, params={"gameId": "206923"}) code = r.get("code", "?") data = r.get("data") shape = "" if isinstance(data, list) and data: first = data[0] if isinstance(data[0], dict) else {} keys = sorted(first.keys())[:8] shape = f" list[{len(data)}] keys={keys}" elif isinstance(data, dict): shape = f" dict keys={sorted(data.keys())[:8]}" print(f"[HIT ] {label:<62} code={code}{shape} ({note})") except Box996Error as e: print(f"[RESP] {label:<62} code={e.code} msg={e.msg[:40]} ({note})") except Exception as e: msg = str(e) tag = "404" if "404" in msg else ("401" if "401" in msg else type(e).__name__) print(f"[{tag:<4}] {label:<62} ({note})") return 0 if __name__ == "__main__": sys.exit(asyncio.run(main()))