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

40 lines
1.8 KiB
Python

# -*- coding: utf-8 -*-
import sys, paramiko
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
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/assign/groups' -o /tmp/gr.json
curl -sS -b /tmp/dy.ck 'https://dy.nomadro.live/api/youtube/live-map' -o /tmp/live.json
python3 <<'PY'
import json
from pathlib import Path
gr = json.loads(Path('/tmp/gr.json').read_text())
live = json.loads(Path('/tmp/live.json').read_text())
print('ALL GROUPS:')
for g in gr.get('groups') or []:
print('-', g.get('name'), 'enabled', g.get('enabled'), 'key', g.get('has_stream_key'), 'neko', g.get('neko_instance_id'))
print(' yt', g.get('youtube_channel_id'))
print(' pk', g.get('channel_pk'))
print(' note', (g.get('note') or '')[:40])
print('\nLIVE MAP live_count', live.get('live_count'))
for k,v in sorted((live.get('entries') or {}).items()):
if v.get('is_live'):
print(' LIVE', k, v.get('title'), v.get('source'), v.get('assign_group_id'))
PY
cd /opt/douyinWEB/backend && .venv/bin/python3 <<'PY'
from app import yt_assign_db, youtube_relay_db, db
for g in yt_assign_db.list_groups(include_urls=False, include_secret=True):
st = youtube_relay_db.get_relay_state(g['id']) or {}
print(g.get('name'), 'key', bool(g.get('stream_key')), 'status', st.get('status'), 'err', (st.get('error') or '')[:60])
PY
"""
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)
_,o,_=c.exec_command(REMOTE,timeout=90)
print(o.read().decode()); c.close()