UNLOCK API

テキストの質問解決API

テキストの質問のタスクをAPIに送ると、コードがページに送信する回答が返ってきます。簡単な足し算や選ぶ単語など、テキストの質問。受け取るもの: テキストの回答。

概要

1,000件あたりの料金
$0.25 (1タスク $0.00025)
createTaskのtype
TextCaptchaTask
in.phpのmethod
textcaptcha
送信するもの
簡単な足し算や選ぶ単語など、テキストの質問
受け取るもの
テキストの回答

値の見つけ方

質問をcommentとして送信します。質問が英語でない場合はlanguagePoolを指定してください。

createTaskとgetTaskResult

タスクを作成し、約5秒待ってから、statusがreadyになるまで5秒ごとに結果を確認します。タスクが失敗した場合はAPIがエラーを返し、料金は残高に戻ります。

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

in.phpとres.php

従来のフォームAPIで同じタスクを送ります。json=1を付けるとJSONで応答し、付けない場合はOK|1001のようなプレーンテキストで応答します。

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リファレンス全文: すべてのパラメータとsolutionオブジェクト