From 203eb54d6cc6038c841fc340bf3fd33379f06ad3 Mon Sep 17 00:00:00 2001 From: Franklin-F Date: Wed, 28 May 2025 22:13:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=20fetch=5Fproxies4=20?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E4=BB=A5=E4=BD=BF=E7=94=A8=20socks5=20?= =?UTF-8?q?=E5=8D=8F=E8=AE=AE=E5=B9=B6=E4=BF=AE=E6=AD=A3=E4=BB=A3=E7=90=86?= =?UTF-8?q?=20IP=20=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- multi_proxy_refill.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/multi_proxy_refill.py b/multi_proxy_refill.py index 52d3e44..937e559 100644 --- a/multi_proxy_refill.py +++ b/multi_proxy_refill.py @@ -49,7 +49,7 @@ def fetch_proxies3(region_code, n): # return [url for _ in range(n) def fetch_proxies4(region_code, n): - url = f"http://api.proxy.roxlabs.io/getProxyIp?num={n}&return_type=json&lb=1&sb=&flow=1®ions={region_code}&protocol=http" + url = f"http://api.proxy.roxlabs.io/getProxyIp?num={n}&return_type=json&lb=1&sb=&flow=1®ions={region_code}&protocol=socks5" try: res = requests.get(url) data_json = res.json() @@ -64,7 +64,7 @@ def fetch_proxies4(region_code, n): for item in arr: ip = item["ip"] port = item["port"] - result.append(f"http://{ip}:{port}") + result.append(f"socks5h://{ip}:{port}") return result def fetch_proxies1(region_code, n): @@ -153,7 +153,7 @@ def refill_queue(r: redis.Redis, region_name: str, region_code: str, to_fetch = batch - length print(f"[{time.strftime('%H:%M:%S')}] {key} 长度 {length} < {low},一次性拉取 {to_fetch} 条…") - proxies = fetch_proxies(region_code, to_fetch) + proxies = fetch_proxies4(region_code, to_fetch) if proxies: r.rpush(key, *proxies) print(f"[{time.strftime('%H:%M:%S')}] 已入队 {len(proxies)} 条 → 新长度 {r.llen(key)}")