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

40 lines
1.4 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("108.174.50.68", 22, "root", "Xiao4669805", timeout=45, allow_agent=False, look_for_keys=False)
cmd = r"""
cd /opt/douyinWEB/backend
.venv/bin/python - <<'PY'
import json
from app import db, youtube_manage
rows = db.list_shorts_channels()
print('count', len(rows))
for ch in rows:
pk = ch.get('id')
sn = youtube_manage._snippet_from_channel_row(ch) or {}
raw = ch.get('yt_profile_json') or ''
title = sn.get('title') or ''
print('---')
print('pk', pk[:8], 'name', ch.get('name'), 'oauth', ch.get('oauth_profile_id'), 'yt_id', ch.get('youtube_channel_id'))
print('oauth_ok', ch.get('oauth_ok'), 'has_refresh', bool(ch.get('refresh_token')))
print('profile_at', ch.get('yt_profile_at'), 'profile_json_len', len(raw))
print('snippet title', title, 'custom', sn.get('custom_url'), 'thumb', (sn.get('thumb_url') or '')[:60])
print('stats', sn.get('statistics'))
if raw:
try:
d = json.loads(raw)
print('cached title', d.get('title'), 'yt_id', d.get('youtube_channel_id'))
except Exception as e:
print('json err', e)
PY
"""
_i, o, e = c.exec_command(cmd, timeout=60)
print(o.read().decode("utf-8", "replace"))
print(e.read().decode("utf-8", "replace")[:800])
c.close()