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

45 lines
1.5 KiB
Python

# -*- coding: utf-8 -*-
from __future__ import annotations
import sys
import paramiko
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
CMD = r"""
name=douyinweb-neko-3
docker exec "$name" python3 /tmp/open_tm.py 2>/dev/null || true
docker exec "$name" python3 - <<'PY'
import json, urllib.request
from pathlib import Path
with urllib.request.urlopen("http://127.0.0.1:9222/json/list", timeout=8) as resp:
tabs = json.loads(resp.read().decode())
print("tabs", len(tabs))
for i,t in enumerate(tabs):
u = t.get("url") or ""
if any(x in u for x in ("youtube","google","studio","accounts")):
print(i, ("*" if t.get("type")=="page" else t.get("type","")), u[:130])
prefs = Path("/home/neko/.config/google-chrome/Default/Preferences")
if prefs.exists():
d = json.loads(prefs.read_text())
sess = d.get("session", {})
print("session_restore", d.get("profile", {}).get("exit_type"), "startup", d.get("session", {}).get("restore_on_startup"))
PY
docker exec "$name" sh -c 'grep -E "start_url|profile_has_session|launch_url" /etc/neko/browser-launch.sh | head -15'
docker exec "$name" sh -c 'echo NEKO_START_URL=$NEKO_START_URL'
"""
def main() -> None:
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect("108.174.50.68", 22, "root", "Xiao4669805", timeout=60, allow_agent=False, look_for_keys=False)
_i, o, e = c.exec_command(CMD, timeout=90)
print(o.read().decode("utf-8", "replace"))
c.close()
if __name__ == "__main__":
main()