| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- """Find the game-detail URL format: click the 柠檬复古76 card title (known
- position from recon) and read the resulting URL, or find router info.
- Safer: check the Vue router's route table for the game-detail path pattern.
- """
- import asyncio
- import json
- import sys
- import httpx
- import websockets
- async def main():
- async with httpx.AsyncClient(timeout=5) as c:
- r = await c.get("http://127.0.0.1:9222/json/list")
- home = next((t for t in r.json() if "homePage" in t.get("url", "")), None)
- if not home:
- print("no home")
- return 1
- async with websockets.connect(home["webSocketDebuggerUrl"], max_size=10**7) as ws:
- mid = 0
- async def ev(expr):
- nonlocal mid
- mid += 1
- await ws.send(json.dumps({"id": mid, "method": "Runtime.evaluate",
- "params": {"expression": expr, "returnByValue": True}}))
- while True:
- m = json.loads(await ws.recv())
- if m.get("id") == mid:
- return m.get("result", {}).get("result", {}).get("value")
- # 1. How does clicking a card work? Inspect the first card's DOM tree
- card = await ev(r"""
- (function() {
- // the 柠檬复古76 card title was at ~(898, 440) region; find clickable ancestors
- const els = document.elementsFromPoint(898, 440);
- const out = [];
- for (const el of els.slice(0, 8)) {
- out.push({
- tag: el.tagName,
- cls: (el.className || '').toString().slice(0, 50),
- href: (el.getAttribute && el.getAttribute('href')) || '',
- onclick: !!el.onclick,
- text: (el.innerText || '').split('\n')[0].slice(0, 30)
- });
- }
- return JSON.stringify(out, null, 1);
- })()
- """)
- print("=== elementsFromPoint(898,440) — the 柠檬 card ===")
- print(card)
- # 2. Vue router present? Get its routes
- routes = await ev(r"""
- (function() {
- const app = document.querySelector('#app');
- if (app && app.__vue_app__) {
- const r = app.__vue_app__.config.globalProperties.$router;
- if (r) {
- return JSON.stringify(r.getRoutes().map(rt => ({path: rt.path.slice(0, 60), name: rt.name})).slice(0, 25));
- }
- }
- if (app && app.__vue__) {
- const r = app.__vue__.$router;
- if (r) return JSON.stringify(r.options.routes.map(rt => ({path: rt.path.slice(0, 60)})));
- }
- return 'no router found';
- })()
- """)
- print("\n=== vue routes ===")
- print(routes)
- # 3. Fallback: known 996box game page URL patterns — check history API
- hist = await ev("""
- JSON.stringify((window.performance && performance.getEntriesByType('navigation').map(n => n.name)) || [])
- """)
- print(f"\nnav entries: {hist}")
- return 0
- sys.exit(asyncio.run(main()))
|