From de5448fceff71c85f229a0715836104378fe404a Mon Sep 17 00:00:00 2001 From: butubb <1422726308@qq.com> Date: Tue, 23 Sep 2025 10:51:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A6=96=E6=AC=A1=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 39804bf..2572134 100644 --- a/main.py +++ b/main.py @@ -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()