修复一个问题批量注册跳出的问题

This commit is contained in:
huangzhenpc
2025-03-11 19:09:29 +08:00
parent 89c5fd4cf9
commit 58d1937231
2 changed files with 54 additions and 51 deletions

View File

@@ -5,6 +5,8 @@ import logging
from dotenv import load_dotenv from dotenv import load_dotenv
load_dotenv() load_dotenv()
# PROXY_HOST = "h464.kdltpspro.com"
# PROXY_PORT = "15818"
PROXY_HOST = "h464.kdltpspro.com" PROXY_HOST = "h464.kdltpspro.com"
PROXY_PORT = "15818" PROXY_PORT = "15818"
PROXY_URL = f"http://{PROXY_HOST}:{PROXY_PORT}" PROXY_URL = f"http://{PROXY_HOST}:{PROXY_PORT}"

View File

@@ -735,60 +735,61 @@ if __name__ == "__main__":
timeout_accounts += 1 timeout_accounts += 1
continue continue
if sign_up_account(browser, tab, registration_start_time): # 执行注册流程
# 检查是否超时 registration_result = sign_up_account(browser, tab, registration_start_time)
if check_timeout(registration_start_time): if not registration_result:
logging.warning("放弃当前注册,继续下一个账号") logging.warning("注册过程失败或超时,跳过当前账号,继续下一个...")
timeout_accounts += 1 continue
continue
logging.info("正在获取会话令牌...")
token = get_cursor_session_token(tab, start_time=registration_start_time)
if token:
# 检查是否超时
if check_timeout(registration_start_time):
logging.warning("放弃当前注册,继续下一个账号")
timeout_accounts += 1
continue
logging.info("更新认证信息...")
logging.info("重置机器码...")
# 检查是否超时
if check_timeout(registration_start_time):
logging.info(f"API将使用相同代理: {proxy_host}:{proxy_port}") logging.warning("放弃当前注册,继续下一个账号")
timeout_accounts += 1
continue
logging.info("正在获取会话令牌...")
token = get_cursor_session_token(tab, start_time=registration_start_time)
if not token:
logging.error("获取会话令牌失败,跳过当前注册,继续下一个账号...")
continue
# 保存成功注册的账号信息 # 检查是否超时
account_data = { if check_timeout(registration_start_time):
"email": account, logging.warning("放弃当前注册,继续下一个账号")
"password": password, timeout_accounts += 1
"token": token, continue
"register_time": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
"first_name": first_name, logging.info("更新认证信息...")
"last_name": last_name, logging.info("重置机器码...")
'user_agent': user_agent,
'proxy_host': proxy_host, logging.info(f"API将使用相同代理: {proxy_host}:{proxy_port}")
'proxy_port': proxy_port,
'proxy_username': proxy_username,
'proxy_password': proxy_password,
'proxy_data': proxy_data
}
logging.info("更新认证信息...") # 保存成功注册的账号信息
account_data = {
# 添加到成功账号列表 "email": account,
successful_accounts.append(account_data) "password": password,
"token": token,
# # 同步到服务器 "register_time": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
if account_sync.sync_account(account_data): "first_name": first_name,
logging.info("账号已成功同步到服务器") "last_name": last_name,
else: 'user_agent': user_agent,
logging.warning("账号同步到服务器失败") 'proxy_host': proxy_host,
'proxy_port': proxy_port,
'proxy_username': proxy_username,
else: 'proxy_password': proxy_password,
logging.error("获取会话令牌失败,注册流程未完成") 'proxy_data': proxy_data
}
logging.info("更新认证信息...")
# 添加到成功账号列表
successful_accounts.append(account_data)
# # 同步到服务器
if account_sync.sync_account(account_data):
logging.info("账号已成功同步到服务器")
else:
logging.warning("账号同步到服务器失败")
# 计算本次注册用时 # 计算本次注册用时
registration_elapsed = time.time() - registration_start_time registration_elapsed = time.time() - registration_start_time