UNLOCK API

DataDome解決API

DataDomeのタスクをAPIに送ると、コードがページに送信する回答が返ってきます。ページURL、ブロック時の応答に含まれるcaptchaアドレス、ユーザーエージェント、プロキシ。受け取るもの: datadome Cookie。

概要

1,000件あたりの料金
$0.725 (1タスク $0.000725)
createTaskのtype
DataDomeSliderTask
in.phpのmethod
datadome
送信するもの
ページURL、ブロック時の応答に含まれるcaptchaアドレス、ユーザーエージェント、プロキシ
受け取るもの
datadome Cookie

値の見つけ方

DataDomeには自前のプロキシと、閲覧に使うものと同じユーザーエージェントが必要です。captchaUrlはブロックされたページにあるgeo.captcha-delivery.comのアドレスです。

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": "DataDomeSliderTask",
      "websiteURL": "https://example.com/login",
      "captchaUrl": "https://geo.captcha-delivery.com/captcha/?initialCid=...",
      "userAgent": "Mozilla/5.0 ...",
      "proxyType": "http",
      "proxyAddress": "1.2.3.4",
      "proxyPort": 8080
    }
}).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"]["cookie"])
        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=datadome&captcha_url=CAPTCHA_URL&pageurl=https://example.com/login&userAgent=UA&proxy=login:pass@1.2.3.4:8080&proxytype=HTTP&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オブジェクト