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

37 lines
1.6 KiB
Python

# -*- coding: utf-8 -*-
import sys
import paramiko
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect("107.173.30.245", 22, "root", "Xiao4669805", timeout=30, allow_agent=False, look_for_keys=False)
def run(cmd, timeout=120):
_, o, e = c.exec_command(cmd, timeout=timeout)
out = (o.read() + e.read()).decode("utf-8", "replace").strip()
print(out[-5000:] if len(out) > 5000 else out, flush=True)
return out
print(run(r"""cd /opt/douyinWEB/backend && .venv/bin/python - <<'PY'
import inspect
from app.yt_long_pipeline import yt_long_pipeline, try_sample_live_rooms
from app import db
print('file', inspect.getfile(yt_long_pipeline.__class__))
src = inspect.getsource(yt_long_pipeline._loop)
print('has claim pending', 'list_pending_yt_long_jobs' in src)
print('has live sample', 'try_sample_live_rooms' in src)
cfg = db.get_settings_map()
print('enabled', cfg.get('yt_long_enabled'))
# simulate one claim cycle like the loop
from app import yt_long_db
pending = yt_long_db.list_pending_yt_long_jobs(limit=1)
print('pending0', pending[0].get('id') if pending else None, pending[0].get('status') if pending else None)
PY"""))
# Find auth bypass / cookie
print(run("grep -n 'auth\\|login\\|Depends\\|api_key\\|Session' /opt/douyinWEB/backend/app/auth*.py /opt/douyinWEB/backend/app/security*.py /opt/douyinWEB/backend/app/deps*.py 2>/dev/null | head -40"))
print(run("ls /opt/douyinWEB/backend/app | head -60"))
print(run("grep -n 'require_auth\\|API_KEY\\|session' /opt/douyinWEB/backend/app/main.py | head -40"))
c.close()