跳转到主要内容
指南

Evomi 住宅代理配合 NSLSolver:用 Python 和 Node.js 获取 Kasada 请求头、Akamai Cookie 与 cf_clearance

NSLSolver 团队发布于 9 分钟阅读

Evomi 为每种协议提供单独的住宅接入点:HTTP 用 rp.evomi.com:1000,HTTPS 用 rp.evomi-proxy.com:1001,SOCKS5 用 rp.evomi.com:1002,所有定位选项都从密码中读取。本文使用 HTTP 接入点把 Evomi 住宅 IP 交给 NSLSolver,让 Kasada x-kpsdk 请求头、Akamai _abck cookie 和 Cloudflare cf_clearance cookie 都在你随后发送请求的 IP 上获得,并提供 Python 与 Node.js 代码。

NSLSolver 在服务端求解,不使用浏览器,只对成功的求解计费。Cloudflare Challenge、reCAPTCHA v3 和 Akamai 必须使用代理,因为结果与获得它的 IP 绑定。本文特别关注地理位置一致:示例把出口 IP 固定在某个国家和城市,并发送相应的 Accept-Language。

Evomi 住宅代理格式速览

接入点
HTTP rp.evomi.com:1000 · HTTPS rp.evomi-proxy.com:1001 · SOCKS5 rp.evomi.com:1002
认证
USERNAME:PASSWORD_<选项>_<选项>...
粘性会话
_session-<6 至 10 位字母数字>
会话时长
_lifetime-<分钟>(默认 30,最多 1440)
地理定位
_country-US _city-new.york _region-california
完整示例
http://USERNAME:PASSWORD_country-FR_city-paris_session-a1b2c3d4e5_lifetime-30@rp.evomi.com:1000

来自 Evomi 住宅代理文档(docs.evomi.com),2026 年 12 月 1 日核对。USERNAME 与 PASSWORD 为 Evomi 控制台中的代理凭据。

哪些 NSLSolver 求解需要 Evomi 代理?

把 Evomi URL 填入 POST https://api.nslsolver.com/solve 的 proxy 字段,然后让你自己的请求走完全相同的 URL。请直接复用同一个字符串,不要重新拼接,以免会话 ID 发生变化。

求解类型代理与 IP 绑定的内容NSLSolver 每 1,000 次价格
Cloudflare Challenge必需cf_clearance cookie$1.00
Akamai Bot Manager(测试版)必需_abck 与 bm_sz cookie$2.00
reCAPTCHA v3必需分数取决于 IP$1.00
Kasada可选,建议使用x-kpsdk-ct 会话$1.50
Cloudflare Turnstile可选(默认无需代理)默认无$0.80

只对成功的求解计费。Evomi 按你的 Evomi 套餐单独收取代理流量费用。

Evomi 接入点与密码选项

每种协议都有自己的主机和端口。本文使用 rp.evomi.com:1000 配合 http:// URL。HTTPS 接入点是 rp.evomi-proxy.com 的 1001 端口;Evomi 提示,校验证书的客户端会拒绝该端口上的 rp.evomi.com,所以不要混用两个主机名。

定位选项追加在密码后面,用下划线分隔:PASSWORD_country-FR_city-paris_session-a1b2c3d4e5_lifetime-30。不带 _session 时,每个请求都会得到新 IP。

选项示例Evomi 文档说明
_country-_country-US大写 ISO 代码,或 UnitedStates 这样的全称。
_city-_city-new.york小写,用点代替空格。
_region-_region-california地区或州。Evomi 说明国家和地区只需设置其一。
_session-_session-a1b2c3d4e56 至 10 位字母数字。
_lifetime-_lifetime-30单位为分钟;默认 30,最多 1440。
_hardsession- / _lockedsession-_lockedsession-a1b2c3_hardsession 优先延长 IP 的保持时间;_lockedsession 永不换用替代 IP,而是让请求失败。两者都不能与 _lifetime 同时使用。

Evomi 还提供 _isp-、_asn- 和 _continent- 选项(例如 _continent-north.america)。

粘性会话与地理位置一致:cf_clearance 回放

cf_clearance 只在获得它的 IP 上、且只在网站的 Challenge Passage 时长内(默认 30 分钟)有效。Evomi 的默认 lifetime 同样是 30 分钟,所以使用 _session 和默认 lifetime 就已覆盖默认的 Challenge Passage;如果网站允许更长的通行时间,可把 _lifetime 调高,最多 1440。Akamai 的 _abck 和 Kasada 的 x-kpsdk-ct 会话也同样绑定在一个 IP 上。

地理位置一致不只是 IP 的问题。从巴黎 IP 获得的 cookie,只有在回放也来自同一个 IP、且浏览器信号与之相符时才是一致的。示例在求解和回放时都把国家和城市写在 Evomi 密码中,向 Challenge 求解传入相应的 accept_language,之后也发送同样的 Accept-Language。

如果粘性 IP 在 lifetime 结束前发生变化,下一个请求通常会遇到挑战或 403。把它当作信号:生成新的会话 ID 并重新求解,而不是用旧 cookie 重试。Evomi 的 _lockedsession- 会让这种变化显式化:它不会换用替代 IP,而是让请求失败,但不能与 _lifetime 同时使用。

Python:从巴黎住宅 IP 获取 cf_clearance

evomi_proxy() 把选项追加到密码中;secrets.token_hex(5) 生成 10 个字符的会话 ID,正好是 Evomi 允许的上限。同一个代理字符串既传给 NSLSolver,也传给 curl_cffi。

evomi_nslsolver.py
# evomi_nslsolver.py  (pip install curl_cffi)
import secrets
from curl_cffi import requests

NSL_API_KEY = "nsl_YOUR_API_KEY"
EVOMI_USERNAME = "YOUR_EVOMI_USERNAME"
EVOMI_PASSWORD = "YOUR_EVOMI_PASSWORD"
UA = ("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "
      "(KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36")

# Geo-matching: send an Accept-Language that fits the exit country.
ACCEPT_LANGUAGE = {"FR": "fr-FR,fr;q=0.9", "DE": "de-DE,de;q=0.9", "US": "en-US,en;q=0.9"}


def evomi_proxy(country="FR", city=None, session=None, lifetime=30):
    """Evomi residential over HTTP (rp.evomi.com:1000). Options are appended to
    the PASSWORD with underscores. _session- is 6-10 alphanumeric characters;
    _lifetime- is in minutes (default 30, max 1440)."""
    password = f"{EVOMI_PASSWORD}_country-{country}"
    if city:
        password += f"_city-{city}"  # lowercase, dots for spaces: new.york
    if session:
        password += f"_session-{session}_lifetime-{lifetime}"
    return f"http://{EVOMI_USERNAME}:{password}@rp.evomi.com:1000"


def solve(payload):
    r = requests.post("https://api.nslsolver.com/solve",
                      headers={"X-API-Key": NSL_API_KEY}, json=payload, timeout=180)
    data = r.json()
    if r.status_code != 200 or not data.get("success"):
        raise RuntimeError(f"NSLSolver {r.status_code}: {data.get('error', data)}")
    return data


def browser_session(proxy, user_agent, accept_language=None, impersonate="chrome"):
    # TLS fingerprint must match the UA: "chrome" for a Chrome UA, "safari_ios"
    # for the iPhone Safari UA that a Challenge solve returns
    s = requests.Session(impersonate=impersonate)
    s.proxies = {"http": proxy, "https": proxy}
    s.headers["User-Agent"] = user_agent
    if accept_language:
        s.headers["Accept-Language"] = accept_language
    return s


def clearance_for(url, site_key, country="FR", city="paris"):
    """cf_clearance earned and replayed from one French residential IP."""
    lang = ACCEPT_LANGUAGE[country]
    proxy = evomi_proxy(country, city, session=secrets.token_hex(5), lifetime=30)  # 10 chars
    cf = solve({"type": "challenge", "url": url, "site_key": site_key,
                "proxy": proxy, "accept_language": lang})
    s = browser_session(proxy, cf["user_agent"], lang, impersonate="safari_ios")
    for name, value in cf["cookies"].items():  # cf_clearance
        s.cookies.set(name, value)
    return s


site = clearance_for("https://cf-protected.example.com/", "0x4AAAAAAA...")
r = site.get("https://cf-protected.example.com/catalog")
print(r.status_code, r.headers.get("cf-mitigated"))  # 200 None when accepted

Python:通过 Evomi 获取 Kasada x-kpsdk 请求头

p_js_path、fp_host 和 tl_host 可在浏览器 Network 面板中找到。对于短时间内的一批受保护调用,15 分钟的 lifetime 足够;由于大多数网站的 x-kpsdk-cd 只能使用一次,每次调用都要重新求解。

evomi_nslsolver.py
# Same file: Kasada headers through an Evomi session.
kasada_proxy = evomi_proxy("FR", session=secrets.token_hex(5), lifetime=15)

k = solve({
    "type": "kasada",
    "url": "https://www.kasada-site.example.com/login",
    "user_agent": UA,
    "ua_version": 145,
    "kasada_config": {
        "p_js_path": "/<uuid-1>/<uuid-2>/p.js",       # the target's real p.js path (DevTools > Network)
        "fp_host": "www.kasada-site.example.com",     # host serving /fp
        "tl_host": "api.kasada-site.example.com",     # host receiving POST /tl
    },
    "proxy": kasada_proxy,
})

api = browser_session(kasada_proxy, UA, ACCEPT_LANGUAGE["FR"])
r = api.post("https://api.kasada-site.example.com/v1/search",
             headers=k["headers"], json={"q": "..."})
print(r.status_code)  # x-kpsdk-cd is single-use: solve again for the next call

Python:通过 Evomi 获取 Akamai _abck cookie

这里的出口是纽约,按 Evomi 的要求写成 new.york。用同一 User-Agent 回放返回的全部 cookie。Akamai 在 NSLSolver 上处于测试阶段。

evomi_nslsolver.py
# Same file: Akamai cookies through an Evomi session in the US.
akamai_proxy = evomi_proxy("US", city="new.york", session=secrets.token_hex(5), lifetime=60)

ak = solve({
    "type": "akamai",
    "url": "https://akamai-site.example.com/login",
    "user_agent": UA,
    "proxy": akamai_proxy,  # required for akamai
})

shop = browser_session(akamai_proxy, UA, ACCEPT_LANGUAGE["US"])
for name, value in ak["cookies"].items():  # _abck, bm_sz, ...
    shop.cookies.set(name, value)
r = shop.get("https://akamai-site.example.com/api/products")
print(r.status_code)  # 403 "Access Denied" = solve again

Node.js:用 undici 实现同样的流程

使用 undici 的 ProxyAgent 和 dispatcher 选项。由于密码中带有选项,放入 URL 前请用 encodeURIComponent 编码。

evomi-nslsolver.mjs
// evomi-nslsolver.mjs  (Node 18+, npm i undici)
// Use undici's ProxyAgent: node-fetch has no proxy option, and current
// https-proxy-agent versions export { HttpsProxyAgent } (not a default export).
import { randomBytes } from "node:crypto";
import { fetch, ProxyAgent } from "undici";

const NSL_API_KEY = "nsl_YOUR_API_KEY";
const EVOMI_USERNAME = "YOUR_EVOMI_USERNAME";
const EVOMI_PASSWORD = "YOUR_EVOMI_PASSWORD";
const UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 " +
  "(KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36";

// Options go in the PASSWORD; session ids are 6-10 chars (5 random bytes = 10 hex chars).
function evomiProxy({ country = "FR", city, lifetime = 30 } = {}) {
  let password = EVOMI_PASSWORD + "_country-" + country;
  if (city) password += "_city-" + city;
  password += "_session-" + randomBytes(5).toString("hex") + "_lifetime-" + lifetime;
  return "http://" + EVOMI_USERNAME + ":" + encodeURIComponent(password) + "@rp.evomi.com:1000";
}

async function solve(payload) {
  const res = await fetch("https://api.nslsolver.com/solve", {
    method: "POST",
    headers: { "X-API-Key": NSL_API_KEY, "Content-Type": "application/json" },
    body: JSON.stringify(payload),
  });
  const data = await res.json();
  if (!res.ok || !data.success) {
    throw new Error("NSLSolver " + res.status + ": " + (data.error || JSON.stringify(data)));
  }
  return data;
}

const cookieHeader = (cookies) =>
  Object.entries(cookies).map(([k, v]) => k + "=" + v).join("; ");

// 1) Cloudflare Challenge from a Paris residential IP
const cfProxy = evomiProxy({ country: "FR", city: "paris" });
const cf = await solve({
  type: "challenge",
  url: "https://cf-protected.example.com/",
  site_key: "0x4AAAAAAA...",
  proxy: cfProxy,
  accept_language: "fr-FR,fr;q=0.9",
});
const page = await fetch("https://cf-protected.example.com/catalog", {
  dispatcher: new ProxyAgent(cfProxy),
  headers: { "User-Agent": cf.user_agent, "Accept-Language": "fr-FR,fr;q=0.9", Cookie: cookieHeader(cf.cookies) },
});
console.log("challenge", page.status);

// 2) Kasada
const kProxy = evomiProxy({ country: "FR", lifetime: 15 });
const k = await solve({
  type: "kasada",
  url: "https://www.kasada-site.example.com/login",
  user_agent: UA,
  ua_version: 145,
  kasada_config: {
    p_js_path: "/<uuid-1>/<uuid-2>/p.js",     // the target's real p.js path (DevTools > Network)
    fp_host: "www.kasada-site.example.com",   // host serving /fp
    tl_host: "api.kasada-site.example.com",   // host receiving POST /tl
  },
  proxy: kProxy,
});
const api = await fetch("https://api.kasada-site.example.com/v1/search", {
  method: "POST",
  dispatcher: new ProxyAgent(kProxy),
  headers: { ...k.headers, "User-Agent": UA, "Content-Type": "application/json" },
  body: JSON.stringify({ q: "..." }),
});
console.log("kasada", api.status);

// 3) Akamai from New York
const akProxy = evomiProxy({ country: "US", city: "new.york", lifetime: 60 });
const ak = await solve({ type: "akamai", url: "https://akamai-site.example.com/login", user_agent: UA, proxy: akProxy });
const products = await fetch("https://akamai-site.example.com/api/products", {
  dispatcher: new ProxyAgent(akProxy),
  headers: { "User-Agent": UA, "Accept-Language": "en-US,en;q=0.9", Cookie: cookieHeader(ak.cookies) },
});
console.log("akamai", products.status);
// Node's fetch does not copy Chrome's TLS fingerprint; if a strict site still
// blocks it, send the follow-up requests from Python with curl_cffi.

完整 NSLSolver API 文档

Evomi 配合 NSLSolver 的常见问题排查

NSLSolver 各状态码以及 Cloudflare、Kasada、Akamai 错误的含义,请参阅反爬虫错误代码速查。

现象常见原因解决方法
1001 端口出现证书错误在 HTTPS 端口上使用了 rp.evomi.com。HTTPS 使用 rp.evomi-proxy.com:1001,或用 http:// 配合 rp.evomi.com:1000。
每个请求的会话都不同会话 ID 少于 6 或多于 10 个字符,或包含非字母数字字符。生成一个 6 至 10 位的 ID,并复用完全相同的代理字符串。
_lifetime 不生效与 _hardsession- 或 _lockedsession- 同时使用。使用 _session- 配合 _lifetime-,或单独使用另一种会话类型。
城市定位不生效城市名中含有空格或连字符。小写并用点分隔:_city-new.york。
NSLSolver 400 Validation failed代理缺少协议前缀,或缺少必填字段。发送完整的 http:// URL,并检查错误中指出的字段。
NSLSolver 503 Solve failed求解未完成,不计费。按退避策略重试;同一会话反复失败时开启新会话。

相关阅读

常见问题

如何在 NSLSolver 中使用 Evomi 住宅代理?

构造 http://USERNAME:PASSWORD_country-FR_session-a1b2c3d4e5_lifetime-30@rp.evomi.com:1000,填入 POST /solve 的 proxy 字段。后续请求走完全相同的 URL,使其来自获得 cookie 或请求头的 IP。

应该使用哪个 Evomi 接入点?

HTTP 用 rp.evomi.com:1000,HTTPS 用 rp.evomi-proxy.com:1001,SOCKS5 用 rp.evomi.com:1002。本文使用 HTTP 接入点和 http:// URL。

Evomi 粘性会话能持续多久?

使用 _session 时默认 30 分钟;_lifetime 以分钟设置,最多 1440。这个默认值正好对应 Cloudflare 为 cf_clearance 设定的 30 分钟默认 Challenge Passage。

为什么地理位置一致对 cf_clearance 很重要?

cookie 与获得它的访问者绑定。求解和回放保持相同的国家、城市和 IP,再加上与该国家相符的 Accept-Language,才能让这个访问者保持一致。

配合 Evomi 代理使用 NSLSolver 的费用是多少?

NSLSolver 按成功求解计费:Cloudflare Challenge 每 1,000 次 $1.00,Kasada $1.50,Akamai(测试版)$2.00。失败的求解不计费。Evomi 按你的 Evomi 套餐单独收取代理流量费用。

把你的 Evomi 代理接入 NSLSolver

通过你自己的住宅 IP 获取 Kasada 请求头、Akamai cookie 和 cf_clearance,全部在服务端求解,不使用浏览器。只对成功的求解计费,使用 Google、Gmail 或 Proton 注册即可获得免费额度。