UNLOCK API

reCAPTCHA v3解決API

reCAPTCHA v3のタスクをAPIに送ると、コードがページに送信する回答が返ってきます。ページURL、サイトキー、ページアクション、最低スコア。受け取るもの: g-recaptcha-response用のトークン。

概要

1,000件あたりの料金
$0.55 (1タスク $0.00055)
createTaskのtype
RecaptchaV3TaskProxyless, RecaptchaV3Task
in.phpのmethod
userrecaptcha, version=v3
送信するもの
ページURL、サイトキー、ページアクション、最低スコア
受け取るもの
g-recaptcha-response用のトークン

値の見つけ方

サイトキーはapi.jsのアドレスのrender=パラメータ、またはgrecaptcha.executeの呼び出しにあります。pageActionはexecuteに渡されるアクション名です。

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": "RecaptchaV3TaskProxyless",
      "websiteURL": "https://example.com/login",
      "websiteKey": "6LcR_RsTAAAAAFJR_5ZdbQd0SMxL7yIDmSXH1-lo",
      "pageAction": "login",
      "minScore": 0.7
    }
}).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"]["gRecaptchaResponse"])
        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=userrecaptcha&version=v3&action=login&min_score=0.7&googlekey=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オブジェクト