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

32 lines
1.4 KiB
Python

# -*- coding: utf-8 -*-
import json
import sys
import httpx
import paramiko
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
g = paramiko.SSHClient()
g.set_missing_host_key_policy(paramiko.AutoAddPolicy())
g.connect("107.173.30.245", 4014, "eric", "4669805", timeout=40, banner_timeout=80, allow_agent=False, look_for_keys=False)
_, o, e = g.exec_command(
"echo '4669805' | sudo -S -p '' bash -lc '"
"cd /opt/douyinWEB/backend && .venv/bin/python - <<PY\n"
"from app import db\n"
"for c in db.list_shorts_channels():\n"
" print({k:c.get(k) for k in (\"id\",\"name\",\"oauth_ok\",\"oauth_error\",\"youtube_channel_id\",\"oauth_profile_id\")})\n"
" print(\"rt\", bool(c.get(\"refresh_token\")))\n"
"PY\n"
"echo ---log---; tail -30 /tmp/shorts_oauth.log 2>/dev/null || echo no_log\n"
"'"
)
print((o.read()+e.read()).decode("utf-8","replace"))
g.close()
with httpx.Client(base_url="https://dy.nomadro.com", timeout=30) as c:
c.post("/api/auth/login", json={"username":"hackrobot","password":"Xiao4669805@"})
st = c.get("/api/shorts/status").json()
print("issues", json.dumps(st.get("oauth_issues"), ensure_ascii=False)[:800])
for ch in (st.get("board") or {}).get("channels") or []:
print("board", json.dumps({k:ch.get(k) for k in ("id","name","oauth_error","authorized","youtube_channel_id")}, ensure_ascii=False))