修复一个问题批量注册跳出的问题
This commit is contained in:
@@ -5,6 +5,8 @@ import logging
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
# PROXY_HOST = "h464.kdltpspro.com"
|
||||
# PROXY_PORT = "15818"
|
||||
PROXY_HOST = "h464.kdltpspro.com"
|
||||
PROXY_PORT = "15818"
|
||||
PROXY_URL = f"http://{PROXY_HOST}:{PROXY_PORT}"
|
||||
|
||||
@@ -735,60 +735,61 @@ if __name__ == "__main__":
|
||||
timeout_accounts += 1
|
||||
continue
|
||||
|
||||
if sign_up_account(browser, tab, registration_start_time):
|
||||
# 检查是否超时
|
||||
if check_timeout(registration_start_time):
|
||||
logging.warning("放弃当前注册,继续下一个账号")
|
||||
timeout_accounts += 1
|
||||
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("重置机器码...")
|
||||
# 执行注册流程
|
||||
registration_result = sign_up_account(browser, tab, registration_start_time)
|
||||
if not registration_result:
|
||||
logging.warning("注册过程失败或超时,跳过当前账号,继续下一个...")
|
||||
continue
|
||||
|
||||
|
||||
|
||||
logging.info(f"API将使用相同代理: {proxy_host}:{proxy_port}")
|
||||
# 检查是否超时
|
||||
if check_timeout(registration_start_time):
|
||||
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 = {
|
||||
"email": account,
|
||||
"password": password,
|
||||
"token": token,
|
||||
"register_time": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
|
||||
"first_name": first_name,
|
||||
"last_name": last_name,
|
||||
'user_agent': user_agent,
|
||||
'proxy_host': proxy_host,
|
||||
'proxy_port': proxy_port,
|
||||
'proxy_username': proxy_username,
|
||||
'proxy_password': proxy_password,
|
||||
'proxy_data': proxy_data
|
||||
}
|
||||
# 检查是否超时
|
||||
if check_timeout(registration_start_time):
|
||||
logging.warning("放弃当前注册,继续下一个账号")
|
||||
timeout_accounts += 1
|
||||
continue
|
||||
|
||||
logging.info("更新认证信息...")
|
||||
logging.info("重置机器码...")
|
||||
|
||||
logging.info(f"API将使用相同代理: {proxy_host}:{proxy_port}")
|
||||
|
||||
logging.info("更新认证信息...")
|
||||
|
||||
# 添加到成功账号列表
|
||||
successful_accounts.append(account_data)
|
||||
|
||||
# # 同步到服务器
|
||||
if account_sync.sync_account(account_data):
|
||||
logging.info("账号已成功同步到服务器")
|
||||
else:
|
||||
logging.warning("账号同步到服务器失败")
|
||||
|
||||
|
||||
else:
|
||||
logging.error("获取会话令牌失败,注册流程未完成")
|
||||
# 保存成功注册的账号信息
|
||||
account_data = {
|
||||
"email": account,
|
||||
"password": password,
|
||||
"token": token,
|
||||
"register_time": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
|
||||
"first_name": first_name,
|
||||
"last_name": last_name,
|
||||
'user_agent': user_agent,
|
||||
'proxy_host': proxy_host,
|
||||
'proxy_port': proxy_port,
|
||||
'proxy_username': proxy_username,
|
||||
'proxy_password': proxy_password,
|
||||
'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
|
||||
|
||||
Reference in New Issue
Block a user