UNLOCK API
复杂图片任务

复杂图片任务

如何通过 createTask 或 in.php 向 UNLOCK API 发送 复杂图片任务 任务:任务类型名称、全部参数、solution 对象、代理字段,以及 7 种语言的代码示例。
价格
$0.60 每个任务 $0.0006
你发送
class(recaptcha、hcaptcha、funcaptcha 或 recognition)、图片和任务文字
你得到
哪些图片或格子符合要求

简介和价格

任务类型名称

此类型只有一个名称。
ComplexImageTask

task 对象

type
String必填
任务类型名称。不区分大小写。 ComplexImageTask
class
String必填
这是哪种图片验证,例如 recaptcha 或 hcaptcha。
imagesBase64
Array必填
图片列表,每项为 base64 字符串。
metadata
Object可选
问题和布局,例如 Task 和 Grid。

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

请求

POST /createTask
{
  "clientKey": "YOUR_API_KEY",
  "task": {
    "type": "ComplexImageTask",
    "class": "recaptcha",
    "imagesBase64": [
      "/9j/4AAQSkZJRgABAQ..."
    ],
    "metadata": {
      "Task": "Select all images with a bus",
      "Grid": "3x3"
    }
  }
}

solution 对象

status 为 ready 时在 solution 中返回。
answer
Array
要提交的答案。
POST /getTaskResult
{
  "errorId": 0,
  "taskId": 1001,
  "status": "ready",
  "solution": {
    "answer": [
      false,
      true,
      false,
      false,
      true,
      false,
      false,
      false,
      true
    ]
  },
  "cost": "0.0006",
  "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": "ComplexImageTask",
      "class": "recaptcha",
      "imagesBase64": [
        "/9j/4AAQSkZJRgABAQ..."
      ],
      "metadata": {
        "Task": "Select all images with a bus",
        "Grid": "3x3"
      }
    }
}).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 方法使用。