From e28a922bdb94dc7048cb067a8bf80b3e31b80e6a Mon Sep 17 00:00:00 2001 From: Night-stars-1 <99261160+Night-stars-1@users.noreply.github.com> Date: Wed, 12 Feb 2025 00:10:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=87=AA=E5=AE=9A=E4=B9=89=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E7=BB=93=E6=9E=9C=E7=9A=84=E5=B0=9D=E8=AF=95=E6=AC=A1?= =?UTF-8?q?=E6=95=B0=20(#318)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 修复get_validate_other的result可能不为str,导致报错 * feat: 自定义获取结果尝试次数 --- utils/captcha.py | 2 +- utils/config.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/utils/captcha.py b/utils/captcha.py index e43de50..9de63b8 100644 --- a/utils/captcha.py +++ b/utils/captcha.py @@ -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, diff --git a/utils/config.py b/utils/config.py index 7117bf6..17f3e5f 100644 --- a/utils/config.py +++ b/utils/config.py @@ -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""" @@ -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: """插件数据"""