UNLOCK API

複雜圖片任務 識別 API

向 API 發送 複雜圖片任務 任務,取回你的代碼要提交到頁面的答案。class(recaptcha、hcaptcha、funcaptcha 或 recognition)、圖片及任務文字。你會收到:符合的圖片或格子。

概覽

每 1,000 次價格
$0.60 (每個任務 $0.0006)
createTask 類型
ComplexImageTask
in.php 方法
你需提供
class(recaptcha、hcaptcha、funcaptcha 或 recognition)、圖片及任務文字
你會收到
符合的圖片或格子

在哪裏找到這些數值

以列表發送圖片,指示放在 metadata 中。

createTask 和 getTaskResult

建立任務,等候約 5 秒,然後每 5 秒查詢一次結果,直至狀態為 ready。如任務失敗,API 會回傳錯誤,費用退回你的餘額。

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

完整 API 參考:所有參數和 solution 物件