改回手动检测

This commit is contained in:
2025-09-24 08:52:25 +08:00
parent 95ed674607
commit 1b1eba5393

23
main.py
View File

@@ -44,26 +44,10 @@ def get_auth_from_browser():
driver.requests.clear()
driver.get("https://live.vzan.com/admin/index.html")
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)
input("请手动登录网站,登录完成后按回车继续...")
driver.get(ADMIN_URL)
log("等待页面加载完成...", "INFO")
# 捕获 headers 和 cookies
timeout = 60
start_time = time.time()
@@ -86,11 +70,10 @@ def get_auth_from_browser():
save_auth(captured_headers, captured_cookies)
return {"headers": captured_headers, "cookies": captured_cookies}
# -------------------- 获取话题 -------------------- #
# -------------------- 获取话题 -------------------- #
def get_topics(headers, cookies):
payload = {
"keyword": "", "keytype": 1, "state": -2, "psize": 7, # 因是只处理第一页,这个参数就是操作控制数量
"tag": 0, "page": 1,
"keyword": "", "keytype": 1, "state": -2, "psize": 7, "tag": 0, "page": 1,
"livescene": -1, "typeid": -1, "types": -1, "isOnShelf": -1,
"starttime": "", "endtime": "", "chanid": 0, "isHQOut": 0, "isGHHQOut": 0
}