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

34 lines
1.2 KiB
Python

# -*- coding: utf-8 -*-
import paramiko
script = """import sys
sys.path.insert(0, '/opt/douyinWEB/backend')
from app import db
from app import youtube_manage as ytm
from app.yt_channel_meta import oauth_meta_from_channel
for ch in db.list_shorts_channels(enabled=True):
pid = str(ch.get('oauth_profile_id') or '').upper()
if pid != 'B':
continue
if int(ch.get('oauth_ok') or 0) == 1 and 'force-ssl' not in str(ch.get('oauth_error') or ''):
continue
sn = ytm._snippet_from_channel_row(ch) or {}
meta = oauth_meta_from_channel(ch)
print(ch.get('name'), '|', ch.get('youtube_channel_id'), '|', sn.get('title'), '|', sn.get('custom_url'), '|', meta.get('brand_hint'), '|', (ch.get('note') or '')[:80])
"""
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)
sftp = c.open_sftp()
with sftp.file("/tmp/pb_meta.py", "w") as f:
f.write(script)
sftp.close()
_, o, e = c.exec_command("cd /opt/douyinWEB/backend && .venv/bin/python /tmp/pb_meta.py", timeout=120)
print(o.read().decode("utf-8", "replace"))
err = e.read().decode("utf-8", "replace")
if err.strip():
print("ERR", err[:400])
c.close()