打码服务 / Cloudflare 5 秒盾
Cloudflare 5 秒盾
协议接口 ·
CloudFlareTaskS2Cloudflare Challenge 的解法,返回 cf_clearance 之类的 cookie。
这个类型返回的是 cookie 而不是 token —— 你拿到 cf_clearance 后把它加进后续请求的 Cookie 头里即可。必须自带代理:Cloudflare 的 cookie 和出口 IP 强绑定,所以这个代理必须和你后面发请求用的是同一个。
请求
POST /v1/captcha/solve?timeout=180
Authorization: Bearer arp_xxx
Content-Type: application/json请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
type | string | 是 | 固定填 CloudFlareTaskS2 |
websiteURL | string | 是 | 目标页面地址 |
proxy | string | 是 | 必填。你的代理,格式 http://user:pass@ip:port |
userAgent | string | 否 | 与真实请求一致的 User-Agent |
waitLoad | boolean | 否 | 是否等页面完全加载(更慢但内容更全) |
requiredCookies | array | 否 | 要求返回的 cookie 名,如 ["cf_clearance"] |
只传上表列出的参数即可,认证由网关自动处理。
请求示例
{
"type": "CloudFlareTaskS2",
"websiteURL": "https://example.com/",
"proxy": "http://user:pass@1.2.3.4:8080",
"requiredCookies": ["cf_clearance"]
}响应示例
{
"ok": true, "ready": true, "price": 10, "balance": 930,
"solution": { "cookies": { "cf_clearance": "abc123..." }, "user_agent": "Mozilla/5.0 ..." },
"cookies": { "cf_clearance": "abc123..." }
}怎么取结果:取
cookies,把 cf_clearance 放进后续请求的 Cookie 头。完整调用
curl -X POST 'https://api.xiaobaicap.com/v1/captcha/solve?timeout=180' \
-H "Authorization: Bearer arp_xxx" \
-H 'Content-Type: application/json' \
-d '{
"type": "CloudFlareTaskS2",
"websiteURL": "https://example.com/",
"proxy": "http://user:pass@1.2.3.4:8080",
"requiredCookies": ["cf_clearance"]
}'
import requests
r = requests.post(
"https://api.xiaobaicap.com/v1/captcha/solve",
headers={"Authorization": "Bearer arp_xxx"},
params={"timeout": 180},
json={
"type": "CloudFlareTaskS2",
"websiteURL": "https://example.com/",
"proxy": "http://user:pass@1.2.3.4:8080",
"requiredCookies": ["cf_clearance"]
},
timeout=200,
)
d = r.json()
if not d.get("ok"):
raise SystemExit(d)
print(d.get("token") or d.get("text") or d.get("objects"))注意事项
- 后续请求必须用同一个代理出口,换 IP 这个 cookie 立刻失效。
- 代理用用户名 + 密码认证,不要用 IP 白名单。
- 能用 Turnstile 就优先用 Turnstile —— 这一档更慢也更贵。
错误
失败时返回 502,积分全额退回,可以安全重试:
{"error":"识别失败,已全额退回 10 积分:...","code":"mint_failed"}
| code | 含义 | 处理 |
|---|---|---|
insufficient_credits | 积分不足(402,未扣费) | 充值后重试 |
bad_request | 参数不合法或类型不支持(400) | 对照上方参数表改 |
mint_failed | 识别失败(502,已退回) | 退避 2~3 秒重试 |
rate_limited | 触发限流(429) | 按 Retry-After 退避 |