Skip to content

Commit

Permalink
fix: #105
Browse files Browse the repository at this point in the history
  • Loading branch information
mikumifa committed Jun 13, 2024
1 parent aa8e653 commit 29381b0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
23 changes: 11 additions & 12 deletions tab/go.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from datetime import datetime
from json import JSONDecodeError
from urllib.parse import urlencode

import uuid
import gradio as gr
import qrcode
from loguru import logger
Expand Down Expand Up @@ -150,15 +150,6 @@ def start_go(tickets_info_str, time_start, interval, mode, total_attempts, api_k
gt = _data["data"]["geetest"]["gt"]
challenge = _data["data"]["geetest"]["challenge"]
token = _data["data"]["token"]
yield [
gr.update(value=withTimeString("进行验证码验证"), visible=True),
gr.update(visible=True),
gr.update(),
gr.update(visible=True),
gr.update(value=gt),
gr.update(value=challenge),
gr.update(value="hello"),
]
try:
if select_way != 2:
yield [
Expand All @@ -168,7 +159,7 @@ def start_go(tickets_info_str, time_start, interval, mode, total_attempts, api_k
gr.update(visible=True),
gr.update(value=gt),
gr.update(value=challenge),
gr.update(value="hello"),
gr.update(value=uuid.uuid1()),
]
if select_way != 0:
# https://passport.bilibili.com/x/passport-login/captcha?source=main_web
Expand All @@ -181,7 +172,15 @@ def run_validation():

threading.Thread(target=run_validation).start()
except NameError as err:
pass
yield [
gr.update(value=withTimeString("进行验证码验证"), visible=True),
gr.update(visible=True),
gr.update(),
gr.update(visible=True),
gr.update(value=gt),
gr.update(value=challenge),
gr.update(value=uuid.uuid1()),
]
while geetest_validate == "" or geetest_seccode == "":
continue
logger.info(
Expand Down
13 changes: 10 additions & 3 deletions tab/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from config import cookies_config_path
from tab.go import ways_detail, ways
from util.bili_request import BiliRequest

import uuid

def train_tab():
gr.Markdown("""
Expand Down Expand Up @@ -99,7 +99,7 @@ def test_get_challenge(api_key):
gr.update(visible=True), # test_gt_row
gr.update(value="重新生成"), # test_get_challenge_btn
gr.update(),
gr.update(value="hello")
gr.update(value=uuid.uuid1())
]
if select_way != 0:
def run_validation():
Expand All @@ -110,7 +110,14 @@ def run_validation():

threading.Thread(target=run_validation).start()
except NameError as err:
pass
yield [
gr.update(value=test_gt), # test_gt_ui
gr.update(value=test_challenge), # test_challenge_ui
gr.update(visible=True), # test_gt_row
gr.update(value="重新生成"), # test_get_challenge_btn
gr.update(),
gr.update(value=uuid.uuid1())
]
while test_geetest_validate == "" or test_geetest_seccode == "":
continue
_url = "https://api.bilibili.com/x/gaia-vgate/v1/validate"
Expand Down

0 comments on commit 29381b0

Please sign in to comment.