HEX
Server: LiteSpeed
System: Linux houston.panomity.com 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
User: nudepix (1011)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //proc/self/root/workspace/delete_extra_from_file.py
#!/usr/bin/env python3
from __future__ import annotations

import json
import subprocess
import time
from pathlib import Path

WRAPPER = "/root/clawd/skills/x-twitter/scripts/x_twitter.py"
PROFILE = "datathrop"
IN = Path("/workspace/extra_missing.jsonl")
PROGRESS = Path("/workspace/datathrop_progress.json")

if not IN.exists():
    print("No extra file")
    raise SystemExit(0)

rows = []
for line in IN.read_text(encoding="utf-8").splitlines():
    try:
        rows.append(json.loads(line))
    except Exception:
        continue

print(f"Loaded {len(rows)} candidate rows")

progress = json.loads(PROGRESS.read_text(encoding="utf-8")) if PROGRESS.exists() else {"found":0,"deleted":0,"failed":0,"seen_ids":[]}

ok = 0
fail = 0
fails = []

for idx, t in enumerate(rows, 1):
    tid = t.get("id")
    text = t.get("text", "")
    if not tid:
        fail += 1
        fails.append("<missing-id>")
        continue
    cmd = "unretweet" if str(text).startswith("RT @") else "delete"
    url = f"https://x.com/datathrop/status/{tid}"
    attempt = 0
    success = False
    while attempt < 3 and not success:
        attempt += 1
        p = subprocess.run(["python3", WRAPPER, "--profile-key", PROFILE, cmd, url], capture_output=True, text=True, timeout=120)
        if p.returncode != 0:
            err = (p.stdout + p.stderr).lower()
            if "429" in err:
                print(f"429 on {tid}, attempt {attempt}/3, wait 60s")
                time.sleep(60)
                continue
            if "not found" in err or "does not exist" in err:
                success = True
                break
            success = False
            break
        try:
            data = json.loads(p.stdout)
            if isinstance(data, dict) and data.get("ok"):
                success = True
                break
        except Exception:
            if '"status_code": 200' in p.stdout:
                success = True
                break
        if p.returncode == 0:
            success = True
            break
    if success:
        ok += 1
        print(f"{idx}/{len(rows)} OK {tid}")
    else:
        fail += 1
        fails.append(tid)
        print(f"{idx}/{len(rows)} FAIL {tid}")
    time.sleep(1)

progress["deleted"] = progress.get("deleted",0) + ok
progress["failed"] = progress.get("failed",0) + fail
PROGRESS.write_text(json.dumps(progress), encoding="utf-8")

print(f"=== delete_from_file done: ok={ok} fail={fail} ===")
if fails:
    Path('/workspace/extra_missing_failed.txt').write_text('\n'.join(fails)+"\n", encoding='utf-8')