# -*- coding: utf-8 -*- """Inspect TikTok upload error without dumping secrets.""" import sys import paramiko sys.stdout.reconfigure(encoding="utf-8", errors="replace") c = paramiko.SSHClient() c.set_missing_host_policy = None 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) PY = "/opt/douyinWEB/backend/.venv/bin/python" def run(cmd: str, timeout: int = 30) -> str: print("$", cmd[:180]) _s, out, err = c.exec_command(cmd, timeout=timeout) o = out.read().decode("utf-8", "replace").strip() e = err.read().decode("utf-8", "replace").strip() if o: print(o) if e: print("ERR:", e[:600]) return o run("journalctl -u douyinweb-api -n 80 --no-pager 2>&1 | tail -80") print("\n=== cookie meta (no secrets) ===") run( f"""{PY} - <<'PY' import pickle, os from pathlib import Path p = Path("/opt/douyinWEB/backend/data/tiktok_cookies") print("dir", p, "exists", p.is_dir()) if p.is_dir(): for f in sorted(p.glob("*.cookie")): try: data = pickle.load(f.open("rb")) except Exception as e: print(f.name, "load_fail", e) continue names = [] for c in data if isinstance(data, list) else []: if isinstance(c, dict) and c.get("name"): names.append(str(c.get("name"))) if c.get("name") == "tt-target-idc": print(f.name, "dc=", c.get("value")) print(f.name, "cookies=", names, "n=", len(names), "bytes=", f.stat().st_size) PY""" ) c.close()