|
|
@@ -27,6 +27,7 @@ def generate_random_account_detail() -> Dict:
|
|
|
departure_schengen_area_date = (base_date + timedelta(days=random.randint(2, 15))).strftime("%Y-%m-%d")
|
|
|
|
|
|
default_payload = {
|
|
|
+ "pool_name": "tls.gb.fr.sentinel",
|
|
|
"email": f"user{random.randint(100000, 999999)}@gmail-app.com",
|
|
|
"pwd": "Visafly@111",
|
|
|
"location": "London",
|
|
|
@@ -76,6 +77,7 @@ def generate_random_account_detail() -> Dict:
|
|
|
email = f"{email_prefix}{random.randint(1000, 9999)}@gmail-app.com"
|
|
|
|
|
|
return {
|
|
|
+ "pool_name": "tls.gb.fr.sentinel",
|
|
|
"email": email,
|
|
|
"pwd": "Visafly@111",
|
|
|
"location": city,
|
|
|
@@ -165,7 +167,43 @@ class TlsRegistrator:
|
|
|
viewport_height = self.page.rect.viewport_size[1]
|
|
|
init_x = random.randint(10, viewport_width - 10)
|
|
|
init_y = random.randint(10, viewport_height - 10)
|
|
|
- self.mouse.move(init_x, init_y)
|
|
|
+ self.mouse.move(init_x, init_y)
|
|
|
+
|
|
|
+ def upload_account_to_server(self):
|
|
|
+ """
|
|
|
+ 将注册成功的账号上报到中心服务器
|
|
|
+ """
|
|
|
+ api_url = 'https://visafly.top/api/account/add'
|
|
|
+ api_token = 'tok_e946329a60ff45ba807f3f41b0e8b7fc' # 你的 Bearer Token
|
|
|
+
|
|
|
+ # 构造请求头
|
|
|
+ headers = {
|
|
|
+ 'accept': 'application/json',
|
|
|
+ 'Authorization': f'Bearer {api_token}',
|
|
|
+ 'Content-Type': 'application/json'
|
|
|
+ }
|
|
|
+
|
|
|
+ # 构造主 Payload
|
|
|
+ payload = {
|
|
|
+ "pool_name": self.account_detail.get("pool_name", "default_pool"),
|
|
|
+ "username": self.account_detail.get("email"),
|
|
|
+ "password": self.account_detail.get("password"),
|
|
|
+ "extra_data": self.account_detail
|
|
|
+ }
|
|
|
+
|
|
|
+ try:
|
|
|
+ self._log(f"Uploading account {self.account_detail['email']} to server...")
|
|
|
+ resp = requests.post(api_url, json=payload, headers=headers, timeout=10)
|
|
|
+
|
|
|
+ if resp.status_code == 200:
|
|
|
+ self._log(f"✅ [API Upload Success] Server responded: {resp.text}")
|
|
|
+ return True
|
|
|
+ else:
|
|
|
+ self._log(f"❌ [API Upload Failed] Status: {resp.status_code}, Body: {resp.text}")
|
|
|
+ return False
|
|
|
+ except Exception as e:
|
|
|
+ self._log(f"❌ [API Upload Error]: {e}")
|
|
|
+ return False
|
|
|
|
|
|
def solve_captcha(self, page_url: str, task_type: str, site_key: str, use_proxy = False, action: str = None, api_domain: str = None) -> str:
|
|
|
"""通用解决验证码 (同步 User-Agent 防止被盾识别为高风险)"""
|
|
|
@@ -298,6 +336,7 @@ class TlsRegistrator:
|
|
|
raise BizLogicError(message=f"Wait ele={btn_selector} timeout")
|
|
|
self.page.ele(btn_selector).click()
|
|
|
time.sleep(3)
|
|
|
+ return True
|
|
|
|
|
|
def make_account_useful(self):
|
|
|
|
|
|
@@ -520,6 +559,7 @@ class TlsRegistrator:
|
|
|
submit_btn = self.page.ele('tag:button@@text():Confirm')
|
|
|
submit_btn.scroll.to_see(center=True)
|
|
|
submit_btn.click()
|
|
|
+ return True
|
|
|
|
|
|
def cleanup(self):
|
|
|
"""清理浏览器进程和缓存文件夹"""
|
|
|
@@ -552,9 +592,10 @@ if __name__ == "__main__":
|
|
|
bot.init_browser()
|
|
|
now_utc = datetime.utcnow()
|
|
|
sent_at = now_utc.strftime("%Y-%m-%d %H:%M:%S")
|
|
|
- bot.register()
|
|
|
+ bot.register()
|
|
|
bot.activate(sent_at=sent_at)
|
|
|
bot.make_account_useful()
|
|
|
+ bot.upload_account_to_server()
|
|
|
except Exception as e:
|
|
|
print(f'Exception Info={e}')
|
|
|
time.sleep(3600)
|