修改首次登录检测

This commit is contained in:
2025-09-23 10:51:34 +08:00
parent 28fa66d41d
commit de5448fcef

18
main.py
View File

@@ -44,10 +44,26 @@ def get_auth_from_browser():
driver.requests.clear()
driver.get("https://live.vzan.com/admin/index.html")
input("请手动登录网站,登录完成后按回车继续...")
log("请在浏览器窗口中手动登录...", "INFO")
# 自动检测是否登录成功
timeout = 120 # 最多等 120 秒
start_time = time.time()
while True:
if "admin/index.html" in driver.current_url:
# 登录后会进入后台页面
log("检测到已进入后台管理页面,继续获取认证信息", "INFO")
break
if time.time() - start_time > timeout:
driver.quit()
raise Exception("登录超时,请检查账号密码或验证码")
time.sleep(2)
driver.get(ADMIN_URL)
log("等待页面加载完成...", "INFO")
# 捕获 headers 和 cookies
timeout = 60
start_time = time.time()