fix: 更新代理 API URL 和请求参数以适应新的接口和流量段生成

This commit is contained in:
晓丰 2025-05-17 16:51:45 +08:00
parent 41a74e7408
commit 69137dd128
2 changed files with 15 additions and 17 deletions

View File

@ -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:

View File

@ -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