UNLOCK API
Tugas imej kompleks

Tugas imej kompleks

Cara menghantar tugas Tugas imej kompleks ke UNLOCK API dengan createTask atau in.php: nama jenis tugas, setiap parameter, objek solution, medan proxy dan contoh kod dalam 7 bahasa.
Harga
$0.60 $0.0006 setiap tugas
Anda hantar
class (recaptcha, hcaptcha, funcaptcha atau recognition), imej dan teks tugas
Anda terima
Imej atau sel yang sepadan

Ringkasan dan harga

Nama jenis tugas

Jenis ini ada satu nama.
ComplexImageTask

Objek task

type
StringWajib
Nama jenis tugas. Dipadankan tanpa mengira huruf besar atau kecil. ComplexImageTask
class
StringWajib
Cabaran imej yang mana, contohnya recaptcha atau hcaptcha.
imagesBase64
ArrayWajib
Imej sebagai senarai rentetan base64.
metadata
ObjectPilihan
Soalan dan susun atur, contohnya Task dan Grid.

Medan yang tidak disenaraikan di sini dihantar kepada penyelesai seperti yang dihantar.

Permintaan

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

Objek solution

Dipulangkan dalam solution apabila status ialah ready.
answer
Array
Jawapan untuk dihantar.
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
}

Contoh kod

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")

Kaedah borang in.php

Jenis ini hanya tersedia dengan kaedah JSON.