sh2/d2ypp2/tools/_remote_douyin_diag2.py
2026-06-14 10:41:48 -05:00

29 lines
1.1 KiB
Python

#!/usr/bin/env python3
import paramiko
HOST, USER, PASS, BASE = "10.88.0.4", "eric", "4669805", "/home/eric/d2ypp2-src"
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect(HOST, username=USER, password=PASS, timeout=20)
def run(cmd: str, timeout: int = 120) -> str:
_, o, e = c.exec_command(f"export LC_ALL=C.UTF-8; {cmd}", timeout=timeout, get_pty=True)
return (o.read() + e.read()).decode("utf-8", "replace")
cmds = [
f"head -30 {BASE}/config/youtube.youtube2__ch_mpwri36r_z5lm2.ini",
f"grep -i douyin {BASE}/config/config.ini 2>/dev/null | head -3 || echo no_douyin_cookie",
f"grep -E 'push_proxy|proxy' {BASE}/config/youtube.youtube2__ch_mpwri36r_z5lm2.ini | head -5",
f"cd {BASE} && . .venv/bin/activate && python tools/test_douyin_fetch.py https://live.douyin.com/29155980665 2>&1",
f"grep -c 'def _proxychains_config_for_push' {BASE}/douyin_youtube_ffplay.py",
f"grep -c 'Douyin web API failed' {BASE}/src/spider.py || echo 0",
]
for cmd in cmds:
print("===", cmd[:100])
print(run(cmd)[:2500])
print()
c.close()