douyinWEB/scripts/_probe_cover_urls_now.py
2026-09-13 22:10:49 -05:00

58 lines
2.3 KiB
Python

#!/usr/bin/env python3
import sys
import paramiko
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
# physical: find a cover path
p = paramiko.SSHClient()
p.set_missing_host_key_policy(paramiko.AutoAddPolicy())
p.connect("107.173.30.245", 4014, "eric", "4669805", timeout=40, allow_agent=False, look_for_keys=False)
cmd = r'''echo 4669805 | sudo -S -p '' python3 - <<"PY"
import sqlite3, json, re
c=sqlite3.connect("/opt/douyinWEB/backend/data/monitor.db")
# any url-like cover in sessions
cols=[r[1] for r in c.execute("pragma table_info(sessions)")]
print("session_cols", [x for x in cols if "cover" in x.lower()])
for col in cols:
if "cover" in col.lower():
rows=c.execute(f"select id, {col} from sessions where {col} is not null and {col}!='' limit 5").fetchall()
print(col, rows[:5])
# kv s3
for k,v in c.execute("select key,value from kv_settings where key like '%s3%' or key like '%S3%' or key like '%cover%'").fetchall():
print("kv", k, str(v)[:120])
c.close()
PY'''
_i,o,e=p.exec_command(cmd, timeout=40)
print("PHYS", (o.read()+e.read()).decode("utf-8","replace"))
p.close()
v = paramiko.SSHClient()
v.set_missing_host_key_policy(paramiko.AutoAddPolicy())
v.connect("107.173.30.245", 22, "root", "Xiao4669805", timeout=40, allow_agent=False, look_for_keys=False)
cmd2 = r'''
set +e
# list a few objects via weed http if possible
curl -sS -m 8 'http://127.0.0.1:28333/' | head -c 200; echo
# try common path from physical public base
python3 - <<"PY"
import sqlite3
c=sqlite3.connect("/opt/douyinWEB/backend/data/monitor.db")
cols=[r[1] for r in c.execute("pragma table_info(sessions)")]
print("dylive cover cols", [x for x in cols if "cover" in x.lower()])
for col in cols:
if "cover" in col.lower():
rows=c.execute(f"select id, {col} from sessions where {col}!='' limit 3").fetchall()
print(col, rows)
c.close()
PY
# probe jpg if we find one in covers local path
ls /opt/douyinWEB/backend/data/covers 2>/dev/null | head -5
curl -sS -m 10 -o /dev/null -w 'dy_cover_root=%{http_code}\n' https://dy.nomadro.com/douyin-covers/
curl -sS -m 10 -o /dev/null -w 'dylive_cover_root=%{http_code}\n' https://dylive.nomadro.com/douyin-covers/
curl -sS -m 10 -o /dev/null -w 'opsneko=%{http_code}\n' https://dy.nomadro.com/ops-neko/1/
'''
_i,o,e=v.exec_command(cmd2, timeout=60)
print("VPS", (o.read()+e.read()).decode("utf-8","replace"))
v.close()