# -*- coding: utf-8 -*- import json import sys import 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/assign/schedule' -o /tmp/sch.json curl -sS -b /tmp/dy.ck 'https://dy.nomadro.live/api/youtube/relay/status' -o /tmp/relay.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()) sch = json.loads(Path('/tmp/sch.json').read_text()) relay = json.loads(Path('/tmp/relay.json').read_text()) live = json.loads(Path('/tmp/live.json').read_text()) print('=== relay settings ===') print('auto', relay.get('enabled'), 'pushing', relay.get('pushing_count')) print('settings', relay.get('settings')) print('\n=== keyed groups ===') keyed = [] for g in gr.get('groups') or []: if g.get('enabled') and g.get('has_stream_key'): keyed.append(g) print(g.get('name'), 'id', (g.get('id') or '')[:8]) print(' yt', g.get('youtube_channel_id')) print(' pk', (g.get('channel_pk') or '')[:8]) print(' neko', g.get('neko_instance_id')) print('keyed count groups', len(keyed)) # unique by yt by_yt = {} by_pk = {} for g in keyed: yt = str(g.get('youtube_channel_id') or '').strip() pk = str(g.get('channel_pk') or '').strip() if yt: by_yt.setdefault(yt, []).append(g.get('name')) if pk: by_pk.setdefault(pk, []).append(g.get('name')) print('\nunique youtube_channel_id', len(by_yt)) for yt, names in by_yt.items(): print(' ', yt, '->', names) print('unique channel_pk', len(by_pk)) print('\n=== schedule ===') print('channel_count', sch.get('channel_count'), 'slot_hours', sch.get('slot_hours')) for c in sch.get('channels') or []: print(c.get('start_label'), c.get('end_label'), c.get('name'), 'yt', c.get('youtube_channel_id')) print(' gid', (c.get('group_id') or '')[:8], 'aliases', c.get('alias_group_ids')) print('\n=== live-map ===') print('live_count', live.get('live_count')) for e in (live.get('entries') or live.get('channels') or [])[:10]: if isinstance(e, dict): print(e.get('group_id', e.get('id', ''))[:8] if e.get('group_id') or e.get('id') else e) PY cd /opt/douyinWEB/backend && .venv/bin/python3 <<'PY' from app import yt_assign_db, db groups = yt_assign_db.list_groups(include_urls=False, include_secret=True) for g in groups: if g.get('enabled') and g.get('has_stream_key'): print('DB', g.get('name')) print(' yt_id', repr(g.get('youtube_channel_id'))) print(' pk', g.get('channel_pk')) print(' key', (g.get('stream_key') or '')[:12]) 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, e = c.exec_command(REMOTE, timeout=120) print(o.read().decode()) if e.read(): print("ERR", e.read().decode()) c.close()