UNLOCK API
Complex image task

Complex image task

Paano magpadala ng Complex image task task sa UNLOCK API gamit ang createTask o in.php: mga pangalan ng task type, bawat parameter, ang solution object, mga proxy field at code sample sa 7 wika.
Presyo
$0.60 $0.0006 bawat task
Ipapadala mo
class (recaptcha, hcaptcha, funcaptcha o recognition), ang mga image at ang text ng task
Matatanggap mo
Kung aling mga image o cell ang tugma

Overview at presyo

Mga pangalan ng task type

Isa lang ang pangalan ng type na ito.
ComplexImageTask

Task object

type
StringRequired
Pangalan ng task type. Tumutugma kahit anong letter case. ComplexImageTask
class
StringRequired
Kung anong image challenge ito, halimbawa recaptcha o hcaptcha.
imagesBase64
ArrayRequired
Ang mga image bilang listahan ng base64 string.
metadata
ObjectOptional
Ang tanong at ang layout, halimbawa Task at Grid.

Ang mga field na wala sa listahang ito ay ipinapasa sa solver kung paano ipinadala.

Request

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 object

Ibinabalik sa solution kapag ready ang status.
answer
Array
Ang sagot na isusumite.
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
}

Mga code sample

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 form method

Sa JSON methods lang available ang type na ito.