douyinWEB/scripts/_verify_yt_live_map_relay.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

32 lines
1.3 KiB
Python

# -*- coding: utf-8 -*-
import json, sys, time, 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
sleep 3
curl -sS -b /tmp/dy.ck 'https://dy.nomadro.live/api/youtube/live-map?force=1' -o /tmp/yt.json
python3 <<'PY'
import json
from pathlib import Path
d = json.loads(Path('/tmp/yt.json').read_text())
print('live_count', d.get('live_count'), 'refreshing', d.get('refreshing'))
for k,v in sorted((d.get('entries') or {}).items()):
if v.get('is_live') or k.startswith('assign:'):
print(k, v.get('is_live'), v.get('source'), (v.get('title') or '')[:30])
PY
cd /opt/douyinWEB/backend && .venv/bin/python3 <<'PY'
from app import youtube_relay_db
for s in youtube_relay_db.list_relay_states():
if int(s.get('ffmpeg_pid') or 0) or str(s.get('status')) in ('pushing','streaming','starting'):
print('RELAY_DB', s.get('group_id')[:8], s.get('status'), 'pid', s.get('ffmpeg_pid'))
PY
"""
_, o, _ = c.exec_command(REMOTE, timeout=120)
print(o.read().decode())
c.close()