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

50 lines
2.1 KiB
Python

# -*- coding: utf-8 -*-
import 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"""
grep -A12 'location \^~ /neko/7/' /etc/nginx/conf.d/douyinweb-neko-locations.inc
echo '--- neko curl ---'
curl -sS -o /dev/null -w '9205:%{http_code} ' --max-time 5 http://127.0.0.1:9205/; echo
curl -sS -o /dev/null -w '9206:%{http_code} ' --max-time 5 http://127.0.0.1:9206/ 2>/dev/null; echo
curl -sS -o /dev/null -w 'public6:%{http_code} ' --max-time 8 https://dy.nomadro.live/neko/6/; echo
curl -sS -o /dev/null -w 'public7:%{http_code} ' --max-time 8 https://dy.nomadro.live/neko/7/; echo
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 6
curl -sS -b /tmp/dy.ck 'https://dy.nomadro.live/api/youtube/live-map?force=1' -o /tmp/yt2.json
curl -sS -b /tmp/dy.ck 'https://dy.nomadro.live/api/douyin/live-map?force=1' -o /tmp/dy2.json
python3 <<'PY'
import json
from pathlib import Path
for name in ('yt2','dy2'):
d = json.loads(Path(f'/tmp/{name}.json').read_text())
print(name, 'live_count', d.get('live_count'))
for k,v in sorted((d.get('entries') or {}).items()):
if v.get('is_live'):
print(' ', k, v.get('source'), (v.get('title') or v.get('anchor') or '')[:35])
PY
echo '--- neko6 cdp ---'
docker exec douyinweb-neko-6 curl -sS --max-time 5 http://127.0.0.1:9222/json/list 2>/dev/null | python3 <<'PY'
import sys,json
try:
tabs=json.load(sys.stdin)
for t in tabs:
u=t.get('url') or ''
if 'youtube' in u.lower() or 'google' in u.lower():
print(u[:120])
except Exception as e:
print('cdp_err', e)
PY
echo '--- ffmpeg log tail ---'
PID=$(pgrep -f 'live2/ad8m-hmu4' | head -1)
echo pid=$PID
if [ -n "$PID" ]; then tr '\r' '\n' < /proc/$PID/fd/2 2>/dev/null | tail -15; fi
"""
_, o, _ = c.exec_command(REMOTE, timeout=150)
print(o.read().decode())
c.close()