UNLOCK API
KeyCaptcha

KeyCaptcha

如何通过 createTask 或 in.php 向 UNLOCK API 发送 KeyCaptcha 任务:任务类型名称、全部参数、solution 对象、代理字段,以及 7 种语言的代码示例。
价格
$1.495 每个任务 $0.001495
你发送
页面网址和页面上的四个 s_s_c 值
你得到
用于 KeyCaptcha 字段的令牌

简介和价格

任务类型名称

不使用代理时用第一个名称。要通过你自己的代理识别,用第二个名称并加上代理字段。价格相同。
KeyCaptchaTaskProxyless不使用代理
KeyCaptchaTask使用你的代理

task 对象

type
String必填
任务类型名称。不区分大小写。 KeyCaptchaTaskProxyless | KeyCaptchaTask
websiteURL
String必填
出现验证码的页面完整地址,以 http:// 或 https:// 开头。
s_s_c_user_id
String必填
页面中的 s_s_c_user_id 值。
s_s_c_session_id
String必填
页面中的 s_s_c_session_id 值。
s_s_c_web_server_sign
String必填
页面中的 s_s_c_web_server_sign 值。
s_s_c_web_server_sign2
String必填
页面中的 s_s_c_web_server_sign2 值。

此处未列出的字段会原样传给识别方。

代理字段

仅用于代理类型名称。可以分别发送各字段,也可以发送一个 proxy 字符串。
proxyType
String必填
http、https、socks4 或 socks5。
proxyAddress
String必填
代理 IP 地址或主机名。
proxyPort
Integer必填
代理端口。
proxyLogin
String可选
代理用户名(如果代理需要)。
proxyPassword
String可选
代理密码(如果代理需要)。
proxy
String
把所有代理字段写成一个字符串,例如 http://user:pass@1.2.3.4:8080。

使用代理

请求

POST /createTask
{
  "clientKey": "YOUR_API_KEY",
  "task": {
    "type": "KeyCaptchaTaskProxyless",
    "websiteURL": "https://example.com/login",
    "s_s_c_user_id": "184015",
    "s_s_c_session_id": "9ff29e0176e78eb7ba59314f92dbac1b",
    "s_s_c_web_server_sign": "964635241a3e5e76980f2572e5f63452",
    "s_s_c_web_server_sign2": "3ca802a38ffc5831fa293ac2819b1204"
  }
}

solution 对象

status 为 ready 时在 solution 中返回。
token
String
随页面表单提交的令牌。
POST /getTaskResult
{
  "errorId": 0,
  "taskId": 1001,
  "status": "ready",
  "solution": {
    "token": "d58e5a5bb1e2f58a3b2e6c6d6f8a1b2c|..."
  },
  "cost": "0.001495",
  "createTime": 1791640000,
  "endTime": 1791640014,
  "solveCount": 1
}

代码示例

import time, requests

API = "https://unlock-api.com"
KEY = "YOUR_API_KEY"

task = requests.post(f"{API}/createTask", json={
    "clientKey": KEY,
    "task": {
      "type": "KeyCaptchaTaskProxyless",
      "websiteURL": "https://example.com/login",
      "s_s_c_user_id": "184015",
      "s_s_c_session_id": "9ff29e0176e78eb7ba59314f92dbac1b",
      "s_s_c_web_server_sign": "964635241a3e5e76980f2572e5f63452",
      "s_s_c_web_server_sign2": "3ca802a38ffc5831fa293ac2819b1204"
    }
}).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"]["token"])
        break
else:
    raise SystemExit("timed out")

in.php 表单方法

用传统表单请求发送同一任务。res.php 以文本形式返回答案。
in.php, res.php
curl -s "https://unlock-api.com/in.php" -d "key=YOUR_API_KEY&method=keycaptcha&s_s_c_user_id=ID&s_s_c_session_id=SID&s_s_c_web_server_sign=S1&s_s_c_web_server_sign2=S2&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:in.php 和 res.php