此页内容

Turnstile协议接口

captchaRun

378字约1分钟

2024-05-21

请求参数

参考 🔗创建任务: /v2/tasks

参数名类型是否必填说明
captchaTypeString固定为 Turnstile
siteRefererString网站URL,通常为显示验证码的页面地址
siteKeyStringTurnstile key
POST https://api.captcha.run/v2/tasks

Content-Type: application/json
Authorization: Bearer 00000000-0000-0000-0000-000000000000

{
  "captchaType": "Turnstile",
  "siteKey": "xxxxxxxxxxxxx",
  "siteReferer": "xxxxxxxxxxxxx"
}

返回样例

{
    "taskId": "dee46ee7-f261-455f-8866-f7b60c3af65f" // 请记录此 ID,用于之后查询识别结果
}

获取识别结果

请参阅: 🔗获取任务结果: /v2/tasks/{taskId}

完成后的示例返回

{
    "id": "83f4b076-32c1-44fb-a657-cf7d16d16045",
    "account": "ee910a0a-4b48-4819-8739-f729f48601aa",
    "price": "0.012",
    "deducted": true,
    "captchaType": "Turnstile",
    "request": {
        "siteKey": "xxxxxxxxxxxxxxxx",
        "siteReferer": "xxxxxxxxxxxxxxxxxxx",
        "captchaType": "Turnstile"
    },
    "response": {
        "token": "0.tj7NuyFX0F9twpRKFUD65MYPT0YXdHiAcXz7OHoFX4NBcUVZxxxxxxxxxxxxxxxxxxxxxx"
    },
    "status": "Success",
    "finished": "2023-08-23T07:02:20.543Z",
    "created": "2023-08-23T07:02:07.655Z",
    "ip": "172.24.179.125, 172.24.178.155",
    "fromCache": false
}

查找siteKey

方案一:搜索代码

通常turnstile是通过js加载的,请在f12的开发人员工具内直接搜索 turnstile.render

如果你没有找到搜索,请在更多工具选项内查找

img1

方案二:查找iframe

使用开发人员工具中的元素选择验证码,并找到类似下面的iframe标签

img2

其中src里0x开头的值就是sitekey