From 165532e63661db22eba95291f8990aa11fe15b51 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 26 Aug 2025 22:51:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E4=BD=BF=E7=94=A8=E4=BB=A3=E7=90=86?= =?UTF-8?q?=E6=B1=A0=E7=9B=B4=E6=8E=A5=E8=8E=B7=E5=8F=96=E5=86=8D=E8=AF=95?= =?UTF-8?q?=E5=B0=9D=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spider/task.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spider/task.py b/spider/task.py index 5bd4acd..00c9e28 100644 --- a/spider/task.py +++ b/spider/task.py @@ -24,6 +24,7 @@ import const from const import BUCKET, BASE_PATH from exceptions import AuthException, OperationFailed from miniofile import client, put_object +from spider.proxy_valid import ProxyChecker def sleep(a, b=None): @@ -852,7 +853,9 @@ def playwright_m_login(username, password, code_2fa=None): with lock: with sync_playwright() as playwright: update_windows_distinguish() - proxy_url = get_proxy_from_api() + proxy_url = ProxyChecker(timeout=8).get_valid_proxy_url() + if proxy_url is None: + raise OperationFailed("获取代理失败") logger.info(f"使用proxy={proxy_url}") browser = playwright.chromium.launch(