Capture Neko/WG/network hubs, Studio viewer charts, physical deploy docs, and one-shot scripts so VPS vs physical can be toggled later without losing WIP. Co-authored-by: Cursor <cursoragent@cursor.com>
41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
import asyncio
|
|
import json
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
sys.path.insert(0, str(ROOT / "backend"))
|
|
|
|
if hasattr(sys.stdout, "reconfigure"):
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
|
|
from app.cookie_loader import find_sh2_cookie
|
|
from app.douyin import check_room
|
|
|
|
|
|
async def main() -> None:
|
|
cookie, src = find_sh2_cookie()
|
|
print("local cookie", len(cookie), "from", src)
|
|
r = await check_room("https://live.douyin.com/81002009942", cookie=cookie)
|
|
slim = {
|
|
"ok": r.get("ok"),
|
|
"is_live": r.get("is_live"),
|
|
"status": r.get("status"),
|
|
"status_code": r.get("status_code"),
|
|
"anchor": (r.get("anchor_name") or "")[:40],
|
|
"title": (r.get("title") or "")[:40],
|
|
"error": r.get("error"),
|
|
"risk": r.get("risk"),
|
|
"n_cands": len(r.get("stream_candidates") or []),
|
|
"raw": r.get("raw"),
|
|
}
|
|
cands = r.get("stream_candidates") or []
|
|
if cands:
|
|
slim["cand0"] = str(cands[0])[:140]
|
|
print(json.dumps(slim, ensure_ascii=True, indent=2))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|