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

44 lines
2.1 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/youtube/live-map?force=1' -o /tmp/yt.json
curl -sS -b /tmp/dy.ck 'https://dy.nomadro.live/api/youtube/assign/groups' -o /tmp/ag.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
yt = json.loads(Path('/tmp/yt.json').read_text())
ag = json.loads(Path('/tmp/ag.json').read_text())
r = json.loads(Path('/tmp/r.json').read_text())
print('yt live_count', yt.get('live_count'))
live_entries = [(k,v) for k,v in (yt.get('entries') or {}).items() if v.get('is_live')]
print('live entries', len(live_entries))
for k,v in sorted(live_entries):
print(' ', k, 'assign_group_id=', v.get('assign_group_id'), 'title=', (v.get('title') or '')[:40])
for g in ag.get('groups') or []:
if '大师兄' in str(g.get('name','')):
gid = g['id']
pk = g.get('channel_pk')
print('ASSIGN', g.get('name'), 'id=', gid, 'channel_pk=', pk)
ae = (yt.get('entries') or {}).get(f'assign:{gid}')
se = (yt.get('entries') or {}).get(f'shorts:{pk}') if pk else None
print(' assign entry live', (ae or {}).get('is_live'))
print(' shorts entry live', (se or {}).get('is_live'))
print(' NAV href', f'/youtube?focus={gid}')
for g in r.get('groups') or []:
if g.get('is_pushing'):
print('PUSHING', g.get('name'), g.get('source_room_id'), g.get('source_display'))
PY
test -f /opt/douyinWEB/frontend/src/lib/useLiveFocusScroll.ts && echo 'useLiveFocusScroll: OK' || echo 'useLiveFocusScroll: MISSING'
"""
_, o, _ = c.exec_command(REMOTE, timeout=120)
print(o.read().decode())
c.close()