From d6cb8e425171263662b0ffbe2b30e0f490d183e9 Mon Sep 17 00:00:00 2001 From: caiwx86 Date: Mon, 15 Jul 2024 05:10:42 +0800 Subject: [PATCH] fix --- Comics/middlewares.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Comics/middlewares.py b/Comics/middlewares.py index bff5f47..15abe8f 100644 --- a/Comics/middlewares.py +++ b/Comics/middlewares.py @@ -24,7 +24,8 @@ class ProxyMiddleware(object): def process_request(self, request, spider): url = request.url logging.debug(f"proxy url=== {url} {str(url).split('.')[-1]}") - if str(url).split('.')[-1] not in HTTPCACHE_ALLOW_PREFIXS or str(url).replace("https://", "").replace("http://", "").split("/") in HTTPCACHE_PROXY_DOMAINS: + domain = str(url).replace("https://", "").replace("http://", "").split("/")[0] + if str(url).split('.')[-1] not in HTTPCACHE_ALLOW_PREFIXS or domain in HTTPCACHE_PROXY_DOMAINS: if len(PROXY_LIST) != 0: request.meta["proxy"] = random.choice(PROXY_LIST) else: