import json, os, subprocess, sys, time BASE = os.path.dirname(os.path.abspath(__file__)) PY = r"C:\Users\User\AppData\Local\Programs\Python\Python311\python.exe" N = int(sys.argv[1]) if len(sys.argv) > 1 else 10 proxies = json.load(open(os.path.join(BASE, "proxies_fast.json")))[:N] env0 = {k: v for k, v in os.environ.items() if k != "PYTHONPATH"} env0["PYTHONIOENCODING"] = "utf-8" for i, px in enumerate(proxies): port = str(9331 + i * 2) logf = os.path.join(BASE, "z_try_%d.log" % i) env = dict(env0) env.update({"CTX_CHROME_PROXY": "http://" + px, "CTX_CDP_PORT": port, "CTX_CHROME_PROF": BASE + "\\chrome_zz_%d" % i}) print("=== [%d] %s :%s" % (i, px, port), flush=True) try: with open(logf, "w", encoding="utf-8") as f: subprocess.run([PY, os.path.join(BASE, "reg_t3.py")], cwd=BASE, env=env, stdout=f, stderr=subprocess.STDOUT, timeout=700, check=False) except subprocess.TimeoutExpired: print(" timeout", flush=True) t = open(logf, encoding="utf-8", errors="replace").read() marks = [l for l in t.splitlines() if any(k in l for k in ("identity ok", "after verify", "back:", "flagged", "blocked", "token:", "KEY len", "SAVED", "mail:"))] print("\n".join(" " + m[:150] for m in marks[-6:]), flush=True) if "SAVED" in t: print("SUCCESS", px, flush=True) json.dump({"proxy": px}, open(os.path.join(BASE, "win3.json"), "w")) break time.sleep(4)