TurnstileTask#


基于代理的 Cloudflare 403 保护页面绕过解决方案。
返回 cf_clearance cookie 和对应的 user-agent 字符串,可用于访问返回 403 Forbidden 错误的 Cloudflare 保护页面。
价钱: $1.0/K

TurnstileTask 任务对象结构#

名称类型必填描述
typeStringTurnstileTask
websiteURLStringCloudflare 403 保护页面的完整 URL
htmlPageBase64String403 页面完整 HTML 内容的 Base64 编码。可选参数 - 如果不提供,系统将通过您的代理自动获取页面(自动获取模式)。
proxyTypeString代理类型:`http`、`socks4`、`socks5`
proxyAddressString代理服务器 IP 地址或主机名
proxyPortInteger代理端口
proxyLoginString代理登录名
proxyPasswordString代理密码

模式一:自动获取#

当不提供 htmlPageBase64 时,系统会通过您的代理自动获取 403 页面。适用于目标网站无论访问者 IP 地址如何都始终返回 403 页面的情况。

模式二:手动提交 HTML#

当提供 htmlPageBase64 时,您需要捕获 403 页面的 HTML 内容,将其编码为 base64 后在请求中发送。适用于目标网站仅对特定 IP 地址显示 403 页面的情况。

请求示例#

API 端点: https://api.nextcaptcha.com/createTask

方法: POST

内容类型: application/json

模式一:自动获取#

{
    "clientKey":"api key",
    "task": {
        "type":"TurnstileTask",
        "websiteURL":"https://example.com",
        "proxyType":"http",
        "proxyAddress":"your_proxy_address",
        "proxyPort":1234,
        "proxyLogin":"your_proxy_login",
        "proxyPassword":"your_proxy_password"
    }
}

模式二:手动提交 HTML#

{
    "clientKey":"api key",
    "task": {
        "type":"TurnstileTask",
        "websiteURL":"https://example.com",
        "htmlPageBase64":"PCFET0NUWVBFIGh0bWw+PGh0bWw+PGhlYWQ+...",
        "proxyType":"http",
        "proxyAddress":"your_proxy_address",
        "proxyPort":1234,
        "proxyLogin":"your_proxy_login",
        "proxyPassword":"your_proxy_password"
    }
}

响应示例#

{
  "errorId": 0,
  "status": "ready",
  "solution": {
    "cf_clearance": "abc123def456...",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"
  },
  "createTime": 1701234567890,
  "endTime": 1701234567890
}

重要提示:cf_clearance cookie 与以下三个因素绑定,使用 cookie 访问目标网站时必须全部匹配:

  • TLS 指纹:必须使用 Windows Chrome 136 或更新版本的 TLS 指纹。
  • IP 地址:必须使用解决过程中所用的同一代理 IP 地址。
  • User-Agent:必须使用响应中返回的完全相同的 user-agent 字符串。
如果这三个因素(TLS 指纹、IP 地址、User-Agent)中的任何一个不匹配,目标网站仍将返回 403 Forbidden 错误。

示例代码#

import requests
import time
 
CLIENT_KEY = "YOUR_CLIENT_KEY"
WEBSITE_URL = "https://example.com"
PROXY_TYPE = "http"
PROXY_ADDRESS = "your_proxy_address"
PROXY_PORT = 1234
PROXY_LOGIN = "your_proxy_login"
PROXY_PASSWORD = "your_proxy_password"
 
# Step 1: Create task
# Auto Fetch Mode (without htmlPageBase64)
# For sites that always return 403 regardless of IP
task_data = {
    "clientKey": CLIENT_KEY,
    "task": {
        "type": "TurnstileTask",
        "websiteURL": WEBSITE_URL,
        "proxyType": PROXY_TYPE,
        "proxyAddress": PROXY_ADDRESS,
        "proxyPort": PROXY_PORT,
        "proxyLogin": PROXY_LOGIN,
        "proxyPassword": PROXY_PASSWORD
    }
}
 
# Manual Mode: add htmlPageBase64 to the task
# For sites that only return 403 for certain IPs
# task_data["task"]["htmlPageBase64"] = "PCFET0NUWVBFIGh0bWw+..."
 
response = requests.post(
    "https://api.nextcaptcha.com/createTask",
    json=task_data
)
result = response.json()
task_id = result["taskId"]
 
# Step 2: Poll for result
while True:
    time.sleep(3)
    response = requests.post(
        "https://api.nextcaptcha.com/getTaskResult",
        json={
            "clientKey": CLIENT_KEY,
            "taskId": task_id
        }
    )
    result = response.json()
    if result["status"] == "ready":
        cf_clearance = result["solution"]["cf_clearance"]
        user_agent = result["solution"]["userAagent"]
        print(f"cf_clearance: {cf_clearance}")
        print(f"userAagent: {userAgent}")
        break
    elif result["status"] == "failed":
        print(f"Task failed: {result.get('errorDescription')}")
        break
 
# Step 3: Use the cookie with matching TLS, IP, and User-Agent
# IMPORTANT: TLS fingerprint must be Chrome 136+
# IMPORTANT: Must use the same proxy IP and returned user-agent
session = requests.Session()
session.cookies.set("cf_clearance", cf_clearance, domain=".example.com")
session.headers.update({"User-Agent": user_agent})
session.proxies = {
    "https": f"http://{PROXY_LOGIN}:{PROXY_PASSWORD}@{PROXY_ADDRESS}:{PROXY_PORT}"
}
response = session.get(WEBSITE_URL)
print(f"Status: {response.status_code}")

相关链接#