douyinWEB/scripts/_verify_live_relay_now.py
eric d409e416da Ship physical dual-edge stack, Studio CDP live metrics, and ops tooling.
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>
2026-09-04 22:42:40 -05:00

37 lines
1.6 KiB
Python

# -*- coding: utf-8 -*-
import json, sys, paramiko
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect("108.174.50.68", 22, "root", "Xiao4669805", timeout=60, allow_agent=False, look_for_keys=False)
REMOTE = r"""
curl -sS -c /tmp/dy.ck -X POST https://dy.nomadro.live/api/auth/login \
-H 'Content-Type: application/json' \
-d '{"username":"hackrobot","password":"Xiao4669805@"}' >/dev/null
curl -sS -b /tmp/dy.ck 'https://dy.nomadro.live/api/douyin/live-map?force=1' -o /tmp/dy.json
curl -sS -b /tmp/dy.ck 'https://dy.nomadro.live/api/youtube/relay/status' -o /tmp/r.json
python3 <<'PY'
import json
from pathlib import Path
dy = json.loads(Path('/tmp/dy.json').read_text())
print('douyin live_count', dy.get('live_count'))
for k,v in sorted((dy.get('entries') or {}).items()):
if v.get('is_live'):
print(' LIVE', k, v.get('anchor','')[:50], 'enabled', v.get('enabled'))
r = json.loads(Path('/tmp/r.json').read_text())
for g in r.get('groups', []):
if '大师兄' in str(g.get('name','')):
print('RELAY', g.get('name'), g.get('business_status'), g.get('is_pushing'))
print(' source_room', g.get('source_room_id'), g.get('source_display') or g.get('anchor_name'))
print(' source_url', (g.get('source_url') or '')[:80])
log = g.get('recent_log') or ''
if isinstance(log, list):
log = '\n'.join(log)
for line in str(log).splitlines()[-6:]:
print(' ', line[:120])
PY
"""
_, o, _ = c.exec_command(REMOTE, timeout=90)
print(o.read().decode())
c.close()