改回手动检测
This commit is contained in:
21
main.py
21
main.py
@@ -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()
|
||||
@@ -89,8 +73,7 @@ def get_auth_from_browser():
|
||||
# -------------------- 获取话题 -------------------- #
|
||||
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user