UNLOCK API

Capy Puzzle解決API

Capy PuzzleのタスクをAPIに送ると、コードがページに送信する回答が返ってきます。ページURLとCapyのサイトキー。受け取るもの: captchakey、challengekey、answerの値。

概要

1,000件あたりの料金
$1.495 (1タスク $0.001495)
createTaskのtype
CapyTaskProxyless, CapyTask
in.phpのmethod
capy
送信するもの
ページURLとCapyのサイトキー
受け取るもの
captchakey、challengekey、answerの値

値の見つけ方

サイトキーは、ページ内のCapyスクリプトにあるcaptchakeyの値です。

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": "CapyTaskProxyless",
      "websiteURL": "https://example.com/login",
      "websiteKey": "6LcR_RsTAAAAAFJR_5ZdbQd0SMxL7yIDmSXH1-lo"
    }
}).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とres.php

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

curl -s "https://unlock-api.com/in.php" -d "key=YOUR_API_KEY&method=capy&captchakey=SITE_KEY&pageurl=https://example.com/login&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オブジェクト