feat: 更新代理API URL及请求参数格式
This commit is contained in:
parent
75cf8f7345
commit
7822ef9943
@ -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"
|
||||
|
||||
@ -36,17 +36,13 @@ def fetch_proxies(region_code, n):
|
||||
从第三方一次性请求 n 条代理,返回格式化列表
|
||||
"""
|
||||
params = {
|
||||
"auth": "pwd",
|
||||
"format": "1",
|
||||
"n": str(n),
|
||||
"p": "http",
|
||||
"gate": "sea",
|
||||
"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)
|
||||
@ -63,11 +59,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://{user}:{pwd}@{ip}:{port}")
|
||||
result.append(f"http://{ip}:{port}")
|
||||
|
||||
return result
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user