UNLOCK API
Cloudflare Challenge 验证页

Cloudflare Challenge 验证页

如何通过 createTask 或 in.php 向 UNLOCK API 发送 Cloudflare Challenge 验证页 任务:任务类型名称、全部参数、solution 对象、代理字段,以及 7 种语言的代码示例。
价格
$0.725 每个任务 $0.000725
你发送
验证页面的网址、你的 user agent 和一个代理
你得到
cf_clearance cookie

简介和价格

任务类型名称

此类型始终通过你的代理运行,因此代理字段为必填。
AntiCloudflareTask使用你的代理

也接受: CloudflareChallengeTask

task 对象

type
String必填
任务类型名称。不区分大小写。 AntiCloudflareTask
websiteURL
String必填
出现验证码的页面完整地址,以 http:// 或 https:// 开头。
userAgent
String必填
识别时使用的浏览器 User-Agent。提交答案时请使用相同的值。

此处未列出的字段会原样传给识别方。

代理字段

此类型始终通过你的代理运行,因此代理字段为必填。
proxyType
String必填
http、https、socks4 或 socks5。
proxyAddress
String必填
代理 IP 地址或主机名。
proxyPort
Integer必填
代理端口。
proxyLogin
String可选
代理用户名(如果代理需要)。
proxyPassword
String可选
代理密码(如果代理需要)。
proxy
String
把所有代理字段写成一个字符串,例如 http://user:pass@1.2.3.4:8080。

使用代理

请求

POST /createTask
{
  "clientKey": "YOUR_API_KEY",
  "task": {
    "type": "AntiCloudflareTask",
    "websiteURL": "https://example.com/login",
    "userAgent": "Mozilla/5.0 ...",
    "proxyType": "http",
    "proxyAddress": "1.2.3.4",
    "proxyPort": 8080
  }
}

solution 对象

status 为 ready 时在 solution 中返回。
cf_clearance
String
cf_clearance Cookie。请配合相同的 User-Agent 和代理使用。
POST /getTaskResult
{
  "errorId": 0,
  "taskId": 1001,
  "status": "ready",
  "solution": {
    "cf_clearance": "Bi2Gmx0hTtMjhXAH_4WNDHgDTsAbqUqrlXy1q6p..."
  },
  "cost": "0.000725",
  "createTime": 1791640000,
  "endTime": 1791640014,
  "solveCount": 1
}

代码示例

import time, requests

API = "https://unlock-api.com"
KEY = "YOUR_API_KEY"

task = requests.post(f"{API}/createTask", json={
    "clientKey": KEY,
    "task": {
      "type": "AntiCloudflareTask",
      "websiteURL": "https://example.com/login",
      "userAgent": "Mozilla/5.0 ...",
      "proxyType": "http",
      "proxyAddress": "1.2.3.4",
      "proxyPort": 8080
    }
}).json()
if task["errorId"]:
    raise SystemExit(task["errorCode"])

for _ in range(60):   # 60 x 5 s = the 5 minute task limit
    time.sleep(5)
    r = requests.post(f"{API}/getTaskResult", json={"clientKey": KEY, "taskId": task["taskId"]}).json()
    if r["errorId"]:
        raise SystemExit(f"{r['errorCode']}: {r.get('errorDescription', '')}")   # failed tasks are refunded
    if r["status"] == "ready":
        print(r["solution"])
        break
else:
    raise SystemExit("timed out")

in.php 表单方法

此类型只能通过 JSON 方法使用。