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 from urllib.parse import quote
import argparse import argparse
import time import time
@ -187,11 +188,12 @@ def gettoken():
u = uuid.uuid4() u = uuid.uuid4()
uuid_with_dash = str(u) uuid_with_dash = str(u)
uuid_no_dash = u.hex uuid_no_dash = u.hex
traffic_segment = str(random.randint(10**8, 10**9 - 1))
data = { data = {
'client_id': 'f1a362d288c1b98099c7', 'client_id': 'f1a362d288c1b98099c7',
'client_secret': 'eea605b96e01c796ff369935357eca920c5da4c5', 'client_secret': 'eea605b96e01c796ff369935357eca920c5da4c5',
'grant_type': 'client_credentials', 'grant_type': 'client_credentials',
'traffic_segment': '244677', 'traffic_segment': traffic_segment,
'visitor_id': uuid_with_dash, 'visitor_id': uuid_with_dash,
} }
try: try:

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"
@ -42,17 +42,13 @@ def fetch_proxies(region_code, n):
从第三方一次性请求 n 条代理返回格式化列表 从第三方一次性请求 n 条代理返回格式化列表
""" """
params = { params = {
"auth": "pwd", "num": n,
"format": "1", "return_type": "json",
"n": n, "lb": "4",
"p": "http", "sb": "",
"gate": "global", "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)
@ -69,12 +65,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}") result.append(f"http://{ip}:{port}")
return result return result