# -*- coding: utf-8 -*- from __future__ import annotations import sys, paramiko sys.stdout.reconfigure(encoding="utf-8", errors="replace") REMOTE = r""" import asyncio, json, httpx from app import db from app.shorts_oauth import channel_oauth_creds from app.shorts_upload import refresh_access_token, _client_kwargs from app import yt_long_monetize as ym async def main(): target = next(ch for ch in db.list_shorts_channels(enabled=None) if "nomad vlog" in str(ch.get("name") or "").lower()) creds = channel_oauth_creds(target) access = await refresh_access_token( client_id=str(creds["client_id"]), client_secret=str(creds["client_secret"]), refresh_token=str(creds["refresh_token"]), ) ch_id = str(target.get("youtube_channel_id") or "") body = { "context": ym._context(channel_id=ch_id, client_name=62), "botguardResponse": "", "challenge": "", "xguardClientStatus": 0, } url = "https://studio.youtube.com/youtubei/v1/att/esr?alt=json&key=AIzaSyBUPetSUmoZL-OhlxA7ZlfWJRJKBa7VFkE" async with httpx.AsyncClient(**_client_kwargs(timeout=45.0)) as client: resp = await client.post(url, headers=ym._studio_headers(access), json=body) data = resp.json() if resp.content else {} print("att/esr", resp.status_code, json.dumps(data, ensure_ascii=False)[:600]) asyncio.run(main()) """ 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) _, o, e = c.exec_command(f"cd /opt/douyinWEB/backend && .venv/bin/python - <<'PY'\n{REMOTE}\nPY", timeout=90) print(o.read().decode("utf-8", "replace")) if e.read().decode().strip(): print("ERR", e.read().decode()[:400]) c.close()