# -*- coding: utf-8 -*- """Deploy YouTube profile proxy fix + refresh all channel stats.""" from __future__ import annotations import json import sys import time from pathlib import Path import httpx import paramiko sys.stdout.reconfigure(encoding="utf-8", errors="replace") ROOT = Path(__file__).resolve().parents[1] FILES = [ ("backend/app/egress_hub.py", "/tmp/_up_egress_hub.py"), ("backend/app/youtube_manage.py", "/tmp/_up_youtube_manage.py"), ("backend/app/shorts_upload.py", "/tmp/_up_shorts_upload.py"), ("backend/app/shorts_oauth.py", "/tmp/_up_shorts_oauth.py"), ] def main(): 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) sftp = g.open_sftp() for rel, remote in FILES: sftp.put(str(ROOT / rel), remote) sftp.close() cmd = r""" echo '4669805' | sudo -S -p '' bash -lc ' set -e install -m 644 /tmp/_up_egress_hub.py /opt/douyinWEB/backend/app/egress_hub.py install -m 644 /tmp/_up_youtube_manage.py /opt/douyinWEB/backend/app/youtube_manage.py install -m 644 /tmp/_up_shorts_upload.py /opt/douyinWEB/backend/app/shorts_upload.py install -m 644 /tmp/_up_shorts_oauth.py /opt/douyinWEB/backend/app/shorts_oauth.py cd /opt/douyinWEB/backend .venv/bin/python -m py_compile app/egress_hub.py app/youtube_manage.py app/shorts_upload.py app/shorts_oauth.py # ensure egress_mode=shellcrash .venv/bin/python - <