find_server.py 1.1 KB

123456789101112131415161718192021222324252627282930
  1. """Find sid 14414741 in the live srvlist and show its full server config."""
  2. import asyncio
  3. import httpx
  4. import json
  5. async def main():
  6. async with httpx.AsyncClient(timeout=15) as c:
  7. r = await c.get("https://list-box.dhsf.xqhuyu.com/box_serverlist/206923.txt")
  8. data = r.json()
  9. for gid, g in data.items():
  10. for s in g.get("tree", []):
  11. if str(s.get("d")) == "14414741":
  12. print(f"MATCH: {gid} {g.get('list_name')}")
  13. print(json.dumps(s, ensure_ascii=False, indent=2))
  14. return
  15. print("not found in srvlist, trying cache")
  16. cache = "D:/ProgramFiles/996box/GameBoxDownload/1/cq/cache_206923/ResServerlist.txt_206923"
  17. import json as _j
  18. with open(cache) as f:
  19. d2 = _j.load(f)
  20. for gid, g in d2.items():
  21. for s in g.get("tree", []):
  22. if str(s.get("d")) == "14414741":
  23. print(f"FOUND in cache: {gid}")
  24. print(_j.dumps(s, ensure_ascii=False, indent=2))
  25. return
  26. asyncio.run(main())