Skip to content

Commit

Permalink
feat: 手动验证码和Geetest并行处理
Browse files Browse the repository at this point in the history
  • Loading branch information
mikumifa committed Jun 12, 2024
1 parent 07c355e commit 89a583e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
3 changes: 2 additions & 1 deletion geetest/CapSolverValidator.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ def validate(self, appkey, gt, challenge, referer="http://127.0.0.1:7860/") -> s
resp = res.json()
status = resp.get("status")
if status == "ready":
loguru.logger.info(resp.get("solution"))
loguru.logger.info(resp)
return resp.get("solution")['validate']
if status == "failed" or resp.get("errorId"):
loguru.logger.info(resp)
raise ValueError("Solve failed! response: " + res.text)
if status == "processing":
continue
Expand Down
10 changes: 10 additions & 0 deletions tab/go.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,16 @@ def start_go(tickets_info_str, time_start, interval, mode, total_attempts, api_k
gr.update(value="hello"),
]
try:
if select_way != 2:
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"),
]
if select_way != 0:
# https://passport.bilibili.com/x/passport-login/captcha?source=main_web
def run_validation():
Expand Down
25 changes: 15 additions & 10 deletions tab/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ def train_tab():

gr.Markdown("""
| 过码方式 | 使用说明 |
| ------------------ | ------------------------------------------------------------ |
| 手动 | 自己过,速度取决于自己,过程看项目的readme.md的GIF |
| 使用接码网站 rrocr | rrocr 提供的 http://www.rrocr.com<br /> 能过验证码,但是抢票没有测试,慎用 <br /> 需要购买对应的key,速度比手动快,价格 一次大概一分钱<br /> |
| 使用接码网站 CapSolve | CapSolver的过码方式<br />https://www.capsolver.com/zh <br />https://docs.capsolver.com/guide/captcha/Geetest.html|
| 使用接码网站 rrocr | **支持**手动和人工同时使用 <br /> rrocr 提供的 http://www.rrocr.com<br /> 能过验证码,但是抢票没有测试,慎用 <br /> 需要购买对应的key,速度比手动快,价格 一次大概一分钱<br /> |
| 使用接码网站 CapSolve | **不支持**手动和人工同时使用 <br /> CapSolver的过码方式<br />https://www.capsolver.com/zh <br />https://docs.capsolver.com/guide/captcha/Geetest.html|
| ..... | 欢迎Discussion补充 |
""")
Expand Down Expand Up @@ -87,15 +89,18 @@ def test_get_challenge(api_key):
test_csrf = _request.cookieManager.get_cookies_value("bili_jct")
test_geetest_validate = ""
test_geetest_seccode = ""
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="hello")
]

try:
# Capture 不支持同时
if select_way != 2:
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="hello")
]
if select_way != 0:
def run_validation():
global test_geetest_validate, test_geetest_seccode
Expand Down

0 comments on commit 89a583e

Please sign in to comment.