UNLOCK API
Domanda di testo

Domanda di testo

Come inviare un task Domanda di testo a UNLOCK API con createTask o in.php: nomi dei tipi di task, tutti i parametri, l'oggetto solution, i campi proxy ed esempi di codice in 7 linguaggi.
Prezzo
$0.25 $0.00025 per task
Invii
Una domanda in testo, ad esempio una semplice somma o una parola da scegliere
Ricevi
La risposta in testo

Panoramica e prezzo

Nomi dei tipi di task

Questo tipo ha un solo nome.
TextCaptchaTask

Oggetto task

type
StringObbligatorio
Nome del tipo di task. Maiuscole e minuscole sono indifferenti. TextCaptchaTask
comment
StringObbligatorio
La domanda a cui rispondere, come testo.
languagePool
StringFacoltativo
Lingua della risposta, ad esempio en o ru.

I campi non elencati qui vengono passati al risolutore così come sono stati inviati.

Richiesta

POST /createTask
{
  "clientKey": "YOUR_API_KEY",
  "task": {
    "type": "TextCaptchaTask",
    "comment": "What is 7 plus 5?"
  }
}

Oggetto solution

Restituito in solution quando status è ready.
text
String
La risposta come testo.
POST /getTaskResult
{
  "errorId": 0,
  "taskId": 1001,
  "status": "ready",
  "solution": {
    "text": "12"
  },
  "cost": "0.00025",
  "createTime": 1791640000,
  "endTime": 1791640014,
  "solveCount": 1
}

Esempi di codice

import time, requests

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

task = requests.post(f"{API}/createTask", json={
    "clientKey": KEY,
    "task": {
      "type": "TextCaptchaTask",
      "comment": "What is 7 plus 5?"
    }
}).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"]["text"])
        break
else:
    raise SystemExit("timed out")

Metodo form in.php

Lo stesso task con la classica richiesta form. res.php restituisce la risposta come testo.
in.php, res.php
curl -s "https://unlock-api.com/in.php" -d "key=YOUR_API_KEY&method=textcaptcha&textcaptcha=What+is+7+plus+5%3F&json=1"
# {"status":1,"request":"1001"}

curl -s "https://unlock-api.com/res.php?key=YOUR_API_KEY&action=get&id=1001&json=1"
# {"status":0,"request":"CAPCHA_NOT_READY"}  then  {"status":1,"request":"ANSWER"}

API a form: in.php e res.php