From 69137dd1284bd650bc0ba983e736218e5473d060 Mon Sep 17 00:00:00 2001 From: Franklin-F Date: Sat, 17 May 2025 16:51:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E4=BB=A3=E7=90=86=20A?= =?UTF-8?q?PI=20URL=20=E5=92=8C=E8=AF=B7=E6=B1=82=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E4=BB=A5=E9=80=82=E5=BA=94=E6=96=B0=E7=9A=84=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=92=8C=E6=B5=81=E9=87=8F=E6=AE=B5=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 4 +++- multi_proxy_refill.py | 28 ++++++++++++---------------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/main.py b/main.py index 70aa5cf..cea6bc3 100644 --- a/main.py +++ b/main.py @@ -1,3 +1,4 @@ +import random from urllib.parse import quote import argparse import time @@ -187,11 +188,12 @@ def gettoken(): u = uuid.uuid4() uuid_with_dash = str(u) uuid_no_dash = u.hex + traffic_segment = str(random.randint(10**8, 10**9 - 1)) data = { 'client_id': 'f1a362d288c1b98099c7', 'client_secret': 'eea605b96e01c796ff369935357eca920c5da4c5', 'grant_type': 'client_credentials', - 'traffic_segment': '244677', + 'traffic_segment': traffic_segment, 'visitor_id': uuid_with_dash, } try: diff --git a/multi_proxy_refill.py b/multi_proxy_refill.py index f6a2ea9..ddb4ca4 100644 --- a/multi_proxy_refill.py +++ b/multi_proxy_refill.py @@ -25,7 +25,7 @@ REFILL_BATCH = 1000 SLEEP_INTERVAL = 10 # 第三方 API 参数 -PROXY_API_URL = "https://www.kookeey.net/pickdynamicips" +PROXY_API_URL = "http://api.proxy.roxlabs.io/getProxyIp" ACCESS_ID = "2207189" SIGN = "10099426b05c7119e9c4dbd6a7a0aa4e" @@ -42,17 +42,13 @@ def fetch_proxies(region_code, n): 从第三方一次性请求 n 条代理,返回格式化列表 """ params = { - "auth": "pwd", - "format": "1", - "n": n, - "p": "http", - "gate": "global", - "g": region_code, - "r": "0", - "type": "json", - "sign": SIGN, - "accessid": ACCESS_ID, - "dl": "," + "num": n, + "return_type": "json", + "lb": "4", + "sb": "", + "flow": "1", + "regions": region_code, + "protocol": "http" } try: resp = requests.get(PROXY_API_URL, params=params, timeout=10) @@ -69,12 +65,12 @@ def fetch_proxies(region_code, n): result = [] for item in arr: - user = quote(item["username"], safe="") - pwd = quote(item["password"], safe="") + # user = quote(item["username"], safe="") + # pwd = quote(item["password"], safe="") ip = item["ip"] port = item["port"] - result.append(f"http://{user}:{pwd}@{ip}:{port}") - # result.append(f"http://{ip}:{port}") + # result.append(f"http://{user}:{pwd}@{ip}:{port}") + result.append(f"http://{ip}:{port}") return result