feat: 代理传参
This commit is contained in:
parent
bbb2cf1823
commit
8503accfd1
@ -44,7 +44,7 @@ ACCESS_ID = "2207189"
|
|||||||
SIGN = "10099426b05c7119e9c4dbd6a7a0aa4e"
|
SIGN = "10099426b05c7119e9c4dbd6a7a0aa4e"
|
||||||
|
|
||||||
|
|
||||||
def fetch_proxies(region_name: str, n: int) -> list[str]:
|
def fetch_proxies(region_name, n):
|
||||||
"""
|
"""
|
||||||
从第三方一次性请求 n 条代理,返回格式化列表
|
从第三方一次性请求 n 条代理,返回格式化列表
|
||||||
"""
|
"""
|
||||||
@ -97,7 +97,7 @@ def refill_queue(r: redis.Redis, region_name: str, region_code: str,
|
|||||||
|
|
||||||
to_fetch = batch - length
|
to_fetch = batch - length
|
||||||
print(f"[{time.strftime('%H:%M:%S')}] {key} 长度 {length} < {low},一次性拉取 {to_fetch} 条…")
|
print(f"[{time.strftime('%H:%M:%S')}] {key} 长度 {length} < {low},一次性拉取 {to_fetch} 条…")
|
||||||
proxies = fetch_proxies(region_name, to_fetch)
|
proxies = fetch_proxies(region_code, to_fetch)
|
||||||
if proxies:
|
if proxies:
|
||||||
r.rpush(key, *proxies)
|
r.rpush(key, *proxies)
|
||||||
print(f"[{time.strftime('%H:%M:%S')}] 已入队 {len(proxies)} 条 → 新长度 {r.llen(key)}")
|
print(f"[{time.strftime('%H:%M:%S')}] 已入队 {len(proxies)} 条 → 新长度 {r.llen(key)}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user