feat: 更新代理API URL及请求参数格式

This commit is contained in:
晓丰 2025-05-17 11:24:15 +08:00
parent 75cf8f7345
commit 7822ef9943

View File

@ -25,7 +25,7 @@ REFILL_BATCH = 1000
SLEEP_INTERVAL = 10 SLEEP_INTERVAL = 10
# 第三方 API 参数 # 第三方 API 参数
PROXY_API_URL = "https://www.kookeey.net/pickdynamicips" PROXY_API_URL = "http://api.proxy.roxlabs.io/getProxyIp"
ACCESS_ID = "2207189" ACCESS_ID = "2207189"
SIGN = "10099426b05c7119e9c4dbd6a7a0aa4e" SIGN = "10099426b05c7119e9c4dbd6a7a0aa4e"
@ -36,17 +36,13 @@ def fetch_proxies(region_code, n):
从第三方一次性请求 n 条代理返回格式化列表 从第三方一次性请求 n 条代理返回格式化列表
""" """
params = { params = {
"auth": "pwd", "num": n,
"format": "1", "return_type": "json",
"n": str(n), "lb": "4",
"p": "http", "sb": "",
"gate": "sea", "flow": "1",
"g": region_code, "regions": region_code,
"r": "0", "protocol": "http"
"type": "json",
"sign": SIGN,
"accessid": ACCESS_ID,
"dl": ",",
} }
try: try:
resp = requests.get(PROXY_API_URL, params=params, timeout=10) resp = requests.get(PROXY_API_URL, params=params, timeout=10)
@ -63,11 +59,12 @@ def fetch_proxies(region_code, n):
result = [] result = []
for item in arr: for item in arr:
user = quote(item["username"], safe="") # user = quote(item["username"], safe="")
pwd = quote(item["password"], safe="") # pwd = quote(item["password"], safe="")
ip = item["ip"] ip = item["ip"]
port = item["port"] port = item["port"]
result.append(f"http://{user}:{pwd}@{ip}:{port}") # result.append(f"http://{user}:{pwd}@{ip}:{port}")
result.append(f"http://{ip}:{port}")
return result return result