Skip to content

Commit

Permalink
feat: 自定义获取结果的尝试次数 (#318)
Browse files Browse the repository at this point in the history
* fix: 修复get_validate_other的result可能不为str,导致报错

* feat: 自定义获取结果尝试次数
  • Loading branch information
Night-stars-1 authored Feb 11, 2025
1 parent 426a616 commit e28a922
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion utils/captcha.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def get_validate_other(
.replace("{challenge}", challenge)
.replace("{result}", str(result))
)
for i in range(10):
for i in range(_conf.preference.get_geetest_try_count):
log.info(f"第{i}次获取结果")
response = request(
_conf.preference.get_geetest_method,
Expand Down
4 changes: 3 additions & 1 deletion utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ def __init__(
get_geetest_data: Optional[dict] = None,
get_geetest_validate_path="$",
get_geetest_challenge_path="$",
get_geetest_try_count=20,
):
self.geetest_url = geetest_url
"""极验验证URL"""
Expand Down Expand Up @@ -182,7 +183,8 @@ def __init__(
"""获取极验验证validate的路径"""
self.get_geetest_challenge_path = get_geetest_challenge_path
"""获取极验验证challenge的路径"""

self.get_geetest_try_count = get_geetest_try_count
"""获取极验验证结果尝试次数"""

class Config:
"""插件数据"""
Expand Down

0 comments on commit e28a922

Please sign in to comment.