forked from mocasus/Auto-FreeCF
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbatch_run.py
More file actions
80 lines (63 loc) · 1.97 KB
/
Copy pathbatch_run.py
File metadata and controls
80 lines (63 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/env python3
"""Batch runner: Process all workspace accounts through CF Workers AI grabber."""
import subprocess
import sys
import time
from pathlib import Path
ACCOUNTS_FILE = Path(__file__).parent / "accounts.txt"
SUCCESS = []
FAILED = []
def load_accounts():
accounts = []
for line in ACCOUNTS_FILE.read_text().strip().split("\n"):
line = line.strip()
if not line or line.startswith("#"):
continue
email, password = line.split(":", 1)
accounts.append((email, password))
return accounts
def run_grabber(email: str, password: str) -> bool:
"""Run bot.py for a single account."""
print(f"\n{'='*60}")
print(f"📧 Processing: {email}")
print(f"{'='*60}")
result = subprocess.run(
[
sys.executable, "bot.py",
"--email", email,
"--password", password,
],
capture_output=True,
text=True,
timeout=120,
cwd=Path(__file__).parent,
)
print(result.stdout)
if result.returncode != 0:
print(f"❌ STDERR: {result.stderr[:500]}")
return result.returncode == 0
def main():
accounts = load_accounts()
print(f"📋 Loaded {len(accounts)} accounts from {ACCOUNTS_FILE}")
for i, (email, password) in enumerate(accounts, 1):
print(f"\n[{i}/{len(accounts)}]")
ok = run_grabber(email, password)
if ok:
SUCCESS.append(email)
else:
FAILED.append(email)
# Jeda antar akun biar gak kena rate limit
if i < len(accounts):
print("⏳ Waiting 5s before next account...")
time.sleep(5)
print(f"\n{'='*60}")
print(f"📊 BATCH COMPLETE")
print(f" ✅ Success: {len(SUCCESS)}")
print(f" ❌ Failed: {len(FAILED)}")
if SUCCESS:
print(f" Success: {', '.join(SUCCESS)}")
if FAILED:
print(f" Failed: {', '.join(FAILED)}")
print(f"{'='*60}")
if __name__ == "__main__":
main()