API

出于自动化目的,Death By Captcha (DBC) 为用户和开发人员提供 API 以与任何给定软件集成。

求解过程如下:

查看下面的 API 详细信息,了解使用您喜欢的工具和/或编程语言实施 DBC 的更多信息和资源!

版本: 4.6

第三方客户

// Do not forget to reference DeathByCaptcha.dll in your project!
using DeathByCaptcha;

// Put your DBC credentials here.
// Use HttpClient class if you want to use HTTP API.
Client client = (Client) new SocketClient(USERNAME, PASSWORD);

// Put your CAPTCHA file name, stream, or vector of bytes,
// and desired timeout (in seconds) here:
Captcha captcha = client.Decode(CAPTCHA_FILE_NAME, TIMEOUT);
if (captcha.Solved && captcha.Correct) {
    Console.WriteLine("CAPTCHA {0}: {1}", captcha.Id, captcha.Text);

    // Report the CAPTCHA if solved incorrectly.
    // Make sure the CAPTCHA was in fact incorrectly solved!
    if ( ... ) {
        client.Report(captcha);
    }
}

// Repeat for other CAPTCHAs
// Do not forget to reference DeathByCaptcha.dll in your project!
using DeathByCaptcha;

// Put your DBC credentials here.
// Use HttpClient class if you want to use HTTP API.
// Using token authentication in C#/VB, username must be authtoken.

Client client = (Client) new SocketClient("authtoken", token-from-panel);

// Put your CAPTCHA file name, stream, or vector of bytes,
// and desired timeout (in seconds) here:
Captcha captcha = client.Decode(CAPTCHA_FILE_NAME, TIMEOUT);
if (captcha.Solved && captcha.Correct) {
    Console.WriteLine("CAPTCHA {0}: {1}", captcha.Id, captcha.Text);

    // Report the CAPTCHA if solved incorrectly.
    // Make sure the CAPTCHA was in fact incorrectly solved!
    if ( ... ) {
        client.Report(captcha);
    }
}

// Repeat for other CAPTCHAs
require_once 'deathbycaptcha.php';
// Put your DBC credentials here.
// Use DeathByCaptcha_HttpClient class if you want to use HTTP API.
$client = new DeathByCaptcha_SocketClient(USERNAME, PASSWORD);

// Put the CAPTCHA file name or handler, and desired timeout (in seconds) here:
if ($captcha = $client->decode(CAPTCHA_FILE_NAME, TIMEOUT)) {
    echo $captcha['text'] . "\n";
    // Report the CAPTCHA if solved incorrectly.
    // Make sure the CAPTCHA was in fact incorrectly solved!
    if ( ... ) {
        $client->report($captcha['captcha']);
    }
}
// Repeat for other CAPTCHAs
require_once 'deathbycaptcha.php';
// Put your DBC credentials here.
// Use DeathByCaptcha_HttpClient class if you want to use HTTP API.
// To use token username must be authtoken.
$client = new DeathByCaptcha_SocketClient("authtoken", token-from-panel);

// Put the CAPTCHA file name or handler, and desired timeout (in seconds) here:
if ($captcha = $client->decode(CAPTCHA_FILE_NAME, TIMEOUT)) {
    echo $captcha['text'] . "\n";

    // Report the CAPTCHA if solved incorrectly.
    // Make sure the CAPTCHA was in fact incorrectly solved!
    if ( ... ) {
        $client->report($captcha['captcha']);
    }
}
// Repeat for other CAPTCHAs
    

//
// DeathbyCaptcha Node.js API captcha usage example
// Authentication with username/password
//

const dbc = require('../deathbycaptcha');

const username = 'username';     // DBC account username
const password = 'password';     // DBC account password


const captcha_file = '../images/normal.jpg';    // Image filename src

// Death By Captcha Socket Client
// const client = new dbc.SocketClient(username, password);
// Death By Captcha http Client
const client = new dbc.HttpClient(username, password);

// Get user balance
client.get_balance((balance) => {
    console.log(balance);
});

// Solve captcha
client.decode({captcha: captcha_file}, (captcha) => {

    if (captcha) {
        console.log(captcha['captcha'] + ' solved: ' + captcha['text']);

        // Report an incorrectly solved CAPTCHA.
        // Make sure the CAPTCHA was in fact incorrectly solved!
        // client.report(captcha['captcha'], (result) => {
        //   console.log('Report status: ' + result);
        // });
    }

});
// Repeat for other CAPTCHAs
    
    

//
// DeathbyCaptcha Node.js API captcha usage example
// Authentication with token
//

const dbc = require('../deathbycaptcha');

const token_from_panel = 'your-token-from-panel';   // DBC account authtoken

const captcha_file = '../images/normal.jpg';    // Image filename src

// To use token authentication the first parameter must be "authtoken"
const client = new dbc.HttpClient("authtoken", token_from_panel);

// Get user balance
client.get_balance((balance) => {
    console.log(balance);
});

// Solve captcha
client.decode({captcha: captcha_file}, (captcha) => {

    if (captcha) {
        console.log(captcha['captcha'] + ' solved: ' + captcha['text']);

        // Report an incorrectly solved CAPTCHA.
        // Make sure the CAPTCHA was in fact incorrectly solved!
        // client.report(captcha['captcha'], (result) => {
        //   console.log('Report status: ' + result);
        // });
    }

});
// Repeat for other CAPTCHAs
    
    

//
// DeathbyCaptcha Java API captcha usage example
// Authentication with username/password
//

package examples;

import com.DeathByCaptcha.AccessDeniedException;
import com.DeathByCaptcha.Client;
import com.DeathByCaptcha.HttpClient;
import com.DeathByCaptcha.SocketClient;
import com.DeathByCaptcha.Captcha;

import java.io.IOException;

class ExampleSolveCaptchaUserPwd {
    public static void main(String[] args)
            throws Exception {

        // Put your DBC username & password or authtoken here:
        String username = "your_username_here";
        String password = "your_password_here";

        String filename = "src/images/test.jpg";

        // DeathByCaptcha Socket Client
        // Client client = (Client) (new SocketClient(username, password));
        // DeathByCaptcha http Client
        Client client = (Client) (new HttpClient(username, password));
        client.isVerbose = true;

        try {
            try {
                System.out.println("Balance:" + client.getBalance() + " US cents");
            } catch (IOException e) {
                System.out.println("Failed fetching balance: " + e.toString());
                return;
            }

            Captcha captcha = null;
            try {
                // Upload a CAPTCHA and poll for its status
                // the captcha have 120 seconds timeout to solve.
                // refer to each captcha type example
                captcha = client.decode(filename);
            } catch (IOException e) {
                // uploading the captcha fails
                System.out.println("Failed uploading CAPTCHA");
                return;
            }
            if (null != captcha) {
                System.out.println(captcha.id + " solved: " + captcha.text);

                // Report incorrectly solved CAPTCHA if necessary.
                // Make sure you've checked if the CAPTCHA was in fact incorrectly
                // solved, or else you might get banned as abuser.
                //  try {
                //      if (client.report(captcha)) {
                //          System.out.println("Reported as incorrectly solved");
                //      } else {
                //          System.out.println("Reporting incorrectly solved");
                //      }
                //  } catch (IOException e) {
                //      System.out.println("Failed reporting : " + e.toString());
                //  }
            } else {
                // solving the captcha fails
                System.out.println("Failed solving CAPTCHA");
            }
        } catch (com.DeathByCaptcha.Exception e) {
            System.out.println(e);
        }

    }
}
    
    

//
// DeathbyCaptcha Java API captcha usage example
// Authentication with token
//

package examples;

import com.DeathByCaptcha.AccessDeniedException;
import com.DeathByCaptcha.Client;
import com.DeathByCaptcha.HttpClient;
import com.DeathByCaptcha.SocketClient;
import com.DeathByCaptcha.Captcha;

import java.io.IOException;

class ExampleSolveCaptchaToken {
    public static void main(String[] args)
            throws Exception {

        // Put your DBC authtoken here:
        String authtoken = "your_authtoken_here";
        String filename = "src/images/test.jpg";


        // Using authtoken
        Client client = (Client) new HttpClient(authtoken);
        // enable vervose to get more output information
        client.isVerbose = true;

        try {
            try {
                System.out.println("Balance:" + client.getBalance() + " US cents");
            } catch (IOException e) {
                System.out.println("Failed fetching balance: " + e.toString());
                return;
            }

            Captcha captcha = null;
            try {
                // Upload a CAPTCHA and poll for its status
                // the captcha have 120 seconds timeout to solve.
                // refer to each captcha type example
                captcha = client.decode(filename);
            } catch (IOException e) {
                // uploading the captcha fails
                System.out.println("Failed uploading CAPTCHA");
                return;
            }
            if (null != captcha) {
                System.out.println(captcha.id + " solved: " + captcha.text);
            } else {
                // solving the captcha fails
                System.out.println("Failed solving CAPTCHA");
            }
        } catch (com.DeathByCaptcha.Exception e) {
            System.out.println(e);
        }

    }
}
    
We are using command line dotnet 6+
Make sure you already downloaded selenium browser driver
and double check the driver executable is on PATH
You can use ChromeDriver for Chrome or Geckodriver for Firefox
and can switch between these drivers on the C# source code.

Download C# Selenium project from the list above

Edit Program.cs and put your credentials there
string _username = "DBC_USERNAME";
string _password = "DBC_PASSWORD";

In the folder where .csproj file is located
Do the following comands to run the example:

dotnet restore to install the requirements
dotnet build to build the project
dotnet run to run the project

dotnet clean to clean the project


// Repeat for other CAPTCHAs
We are using Maven 3.6+
Make sure you already downloaded selenium browser driver
and double check the driver executable is on PATH
You can use ChromeDriver for Chrome or Geckodriver for Firefox
and can switch between these drivers on the Java source code.

Download Java Selenium project from the list above

Edit App.java and put your credentials there
Client client = new HttpClient("DBC_USERNAME", "DBC_PASSWORD");

In the folder where pom.xml file is located
Do the following comands to run the example:

mvn clean install -U to clean project and install dependencies
mvn exec:java -Dexec.mainClass="deathbycaptcha.App" to build the project

mvn clean to clean the project

Refer to Java and Maven project examples to more detail
We are using NodeJS v12+
Make sure you already downloaded selenium browser driver
and double check the driver executable is on PATH
You can use ChromeDriver for Chrome or Geckodriver for Firefox
and can switch between these drivers on the NodeJS source code.

Download NodeJS Selenium project from the list above

Edit nodeSeleniumExample.js and put your credentials there

const USERNAME = 'DBC_USERNAME'   // Your DBC username here
const PASSWORD = 'DBC_PASSWORD'   // Your DBC password here

In the folder where package.json file is located
Do the following comands to run the example:

npm install // to install dependencies
node recaptcha_example/nodeSeleniumExample.js // to run the example

Refer to NodeJS project examples to more detail
We are using Python v3+
Make sure you already downloaded selenium browser driver
and double check the driver executable is on PATH
You can use ChromeDriver for Chrome or Geckodriver for Firefox
and can switch between these drivers on the Python3 source code.

Download Python3 Selenium project from the list above

Edit python_selenium_example.py and put your credentials there

USERNAME = 'DBC_USERNAME'   # Your DBC username here
PASSWORD = 'DBC_PASSWORD'   # Your DBC password here

In the folder where requirements.txt file is located
Do the following comands to run the example:

python3 -m venv venv to create a new python3 venv
. venv/bin/activate to activate the venv
pip3 install -r requirements.txt to install dependencies
python3 python_selenium_example.py

Refer to Python3 project examples to more detail
Create new Python3 virtual environment

python3 -m venv venv

Activate the virtual environment
. venv/bin/activate

Install DeathByCaptcha library from pypi

pip install deathbycaptcha-official

Create our python3 script

import  deathbycaptcha
# don't forget to import deathbycaptcha library
username = 'username'
password = 'password'
authtoken =  ''
...

use the DeathByCaptcha python http client
http_client = deathbycaptcha.HttpClient(username, password, authtoken)
or use the DeathByCaptcha python sockets client
socket_client = deathbycaptcha.SocketClient(username, password, authtoken)

Refer to Python3 project examples to more detail.
Create new Maven project

mvn archetype:generate
-DgroupId=examples
-DartifactId=deathbycaptcha-examples
-DarchetypeArtifactId=maven-archetype-quickstart
-DarchetypeVersion=1.4
-DinteractiveMode=false

Include the following dependencies on maven pom.xml file

<dependencies>
<dependency>
<groupId>io.github.deathbycaptcha</groupId>
<artifactId>deathbycaptcha-java-library</artifactId>
<version>0.43</version>
</dependency>
</dependencies>

if the pom.xml is correct.
We can use the imports on our java files.

import com.DeathByCaptcha.AccessDeniedException;
import com.DeathByCaptcha.Client;
import com.DeathByCaptcha.HttpClient;
import com.DeathByCaptcha.SocketClient;
import com.DeathByCaptcha.Captcha;
...

Clean and build the project
mvn clean install -U
Run the project
mvn exec:java -Dexec.mainClass="examples.GetBalance" -Dexec.args=""
mvn exec:java -Dexec.mainClass="examples.ExampleRecaptchaV2"
...

Refer to Java and Maven project examples to more detail

使用Socket API客户端时,请确保您没有将TCP连接到端口 8123-8130 firewalled。如果套接字API客户端不适合您,请使用HTTP API客户端。 8123-8130端口范围仅适用于套接字API,请勿尝试与HTTP API使用它!

请注意,如果在验证验证验证验证之前,可以返回对解码函数/方法的调用,则可以返回null值。如果经常发生这种情况,请增加使用的超时。

有关更多详细信息,请参见每个API客户端软件包中包含的示例,并检查客户端源代码。

  1. 要检查您的余额,请运行:
    deathbycaptcha.exe -l USERNAME -p PASSWORD -b
    或使用身份验证令牌
    deathbycaptcha.exe -a AUTHTOKEN -b
    您的余额将保存在 Balance.txt 文件中,并在标准输出中打印出来。
  2. 要上传验证码,请运行:
    deathbycaptcha.exe -l USERNAME -p PASSWORD -c CAPTCHA_FILE_NAME [-t TIMEOUT]
    或使用身份验证令牌
    deathbycaptcha.exe -a AUTHTOKEN -c CAPTCHA_FILE_NAME [-t TIMEOUT]
    默认的验证码求解超时为60秒。
    如果解决了,则验证码ID将保存在 id.txt 中,验证码文本将保存在 answert.txt 中,并且ID和文本都将在标准输出由空间隔开。
  3. 要报告错误解决的验证码,请运行:
    deathbycaptcha.exe -l USERNAME -p PASSWORD -n CAPTCHA_ID
    或使用身份验证令牌
    deathbycaptcha.exe -a AUTHTOKEN -n CAPTCHA_ID

在实施自己的 Death By Captcha HTTP API客户端,请认真考虑使用上面列出的官方客户之一使用套接字API。

API URL是 http://api.dbcapi.me/api/. url路径根据所需的动作而变化。对API提出的请求的所有答复都有两个通用字段:

  • status — 请求状态。 0如果内部请求处理过程中没有错误,则为255。
  • error — 简短说明发生的错误。仅当状态为255时返回。

有关正确的URL路径和其他返回字段的特定操作的详细信息,请参阅下面的部分。

All API responses are returned URL-encoded by default. If JSON encoding is desired, include application/json in the Accept header of your request. Note that boolean true will be returned as 1 in URL-encoded responses and as true in JSON-encoded responses. Boolean false will be returned as 0 in URL-encoded responses and as false in JSON-encoded responses.

什么是“正常验证码”挑战?

这种形式的验证码是基于图像的,需要输入扭曲图像中的一系列字母或数字。

要上传验证码,请发出一个multipart/form-data的POST请求到 http://api.dbcapi.me/api/captcha. 该请求必须包含以下字段:

  • username — 您的Death By Captcha用户名。
  • password — 您的Death By Captcha密码。
  • captchafile — 验证码图像。

如果您使用令牌身份验证:

  • authtoken — 您的Death By Captcha身份验证令牌。
  • captchafile — 验证码图像。

captchafile 应为原始 CAPTCHA 图像文件或以 base64: 前缀预置的 base64 编码的 CAPTCHA 图像。图像文件大小限制为小于 180 KB。当图像将编码为 base64 时,大小应小于 120 KB。支持的图像格式为 JPG、PNG、GIF 和 BMP

这是解决问题的HTML形式:

<form action="http://api.dbcapi.me/api/captcha"method="post" enctype="multipart/form-data">
    <input type="text"     name="username" value="">
    <input type="password" name="password" value="">
    <input type="file"     name="captchafile">
</form>

或使用令牌身份验证:

<form action="http://api.dbcapi.me/api/captcha"method="post" enctype="multipart/form-data">
    <input type="text"     name="authtoken" value="">
    <input type="file"     name="captchafile">
</form>

这是curl命令等效:

curl --header 'Expect: ' -F username=YOUR_USERNAME  -F password=YOUR_PASSWORD  -F captchafile=@YOUR_CAPTCHA_FILENAME http://api.dbcapi.me/api/captcha

或使用令牌身份验证:

curl --header 'Expect: ' -F authtoken=YOUR_AUTHTOKEN  -F captchafile=@YOUR_CAPTCHA_FILENAME http://api.dbcapi.me/api/captcha

base64编码captchafile字段应该看起来像这样:

base64:R0lGODlhAQABAIABAAAAAP///yH5BAEAAAEALAAAAAABAAEAAAICTAEAOw==

您将获得以下HTTP响应之一:

  • 303 See Other 如果您的验证码成功上传,会指向已上传的验证码状态页的HTTP头Location。 您可以跟随该Location以获取已上传的验证码状态。 另外,以下字段将返回:
    • captcha — 上载验证码的ID。
    • is_correct — 1如果已确定了该验证验的答案或仍在处理该答案,则0如果处理完成并且找不到答案。
    • text — 验证码答案。一个空字符串意味着验证码尚未解决。
    URL编码示例:
    status=0&captcha=123&is_correct=1&text=
    JSON编码示例:
    { "status": 0, "captcha": 123, "is_correct": 1, "text": "" }
  • 403 Forbidden 如果您的Death By Captcha凭证的死亡被拒绝,或者您没有足够的信用。
  • 400 Bad Request 如果您的请求未遵循上面的规范,或者因没有有效图像而被拒绝验证码。
  • 500 Internal Server Error 如果我们一边发生了一些事情,阻止您上传验证码;如果您确定要使用有效的CATPCHA图像发送正确结构的请求,但问题仍然存在,请联系我们的实时支持,并详细告诉他们如何重现该问题。
  • 503 Service Temporarily Unavailable 当我们的服务超载时,请稍后再试。

在这一点上,您刚刚上传的CAPTCHA可能尚未解决!如果您没有在服务器响应的text键中收到答案,则必须对其进行轮询。有关更多详细信息,请参见轮询已上传CAPTCHA状态

要获得上传验证码的状态,请向 http://api.dbcapi.me/api/captcha/%CAPTCHA_ID%, 其中%CAPTCHA_ID%是您上传的验证码的ID,在上传验证码时获得. 这次您不必提供Death By Captcha凭据。 响应将是HTTP 200 OK响应,并包含与上传验证码部分的303 See Other响应中描述的相同字段。

如果尚未解决验证码,则text键将空。您将不得不继续进行此答案。示例响应:

  • 正确求解的验证验的URL编码响应
    status=0&captcha=1234&is_correct=1&text=tyrone+slothrop
  • JSON编码的正确解决的验证码的响应
    { "captcha": 1234, "is_correct": true,"status": 0, "text": "tyrone slothrop" }
  • JSON编码的错误解决的验证码的响应
    { "captcha": 1234, "is_correct": false, "status": 0, "text": "?" }
  • JSON编码的验证码的响应
    { "captcha": 0, "status": 0 }
    如果您得到此响应,请确认您用于轮询的验证码ID与上传时返回的答案相同。 如果问题仍然存在,请随时联系我们

不要在几秒钟内多次进行验证验证状态.
这被认为是滥用行为,可能会导致您被禁言。
请节约您和我们的带宽。

如果您认为您的验证码已被错误地解决,请将其报告给Death By Captcha以获取您的钱。 为此,请向http://api.dbcapi.me/api/captcha/%CAPTCHA_ID%/report发出邮政请求:

  • username — 您的Death By Captcha用户名。
  • password — 您的Death By Captcha密码。

或使用身份验证令牌:

  • authtoken — 您的Death By Captcha身份验证令牌。

响应将是:

  • 200 OK 如果报告完成。在这种情况下,您的贷方将被退还。响应主体将与民意调查(或上传)相同,但is_correct字段将为0。示例:
    { "captcha": 1234, "is_correct": false,"status": 0, "text": "tyrone slothrop" }
  • 503 Service Unavailable 如果报告无法完成。这可能是因为:
    1)用户报告的验证码未上传与所提供的ID相对应;
    2)您的用户被禁止;
    3)报告已发布超过一个小时如果上传。在这种情况下,您不会退款。

滥用此功能将使您被禁止!

要查看您的信用余额,请在http://api.dbcapi.me/api上发布get或张贴请求。

  • username — 您的Death By Captcha用户名。
  • password — 您的Death By Captcha密码。

或使用身份验证令牌:

  • authtoken — 您的Death By Captcha身份验证令牌。

成功验证后,您将获得200 OK响应并包含您的Death By Captcha帐户详细信息,可以是URL编码或JSON编码,包含以下字段:

  • user — 您的Death By Captcha帐户ID;
  • rate — 我们向您收取多少美分的正确解决验证码费用;
  • balance — 您当前的信用余额,美分。
  • is_banned — 1如果禁止用户,则0,如果不是。

示例JSON编码的响应:

{ "is_banned": false, "status": 0, "rate": 0.139,"balance": 455.23, "user": 43122 }

为了接收当前服务器状态,请向http://api.dbcapi.me/api/status发出get请求。响应将具有以下字段:

  • todays_accuracy — 代表百分比准确性的数字(例如99.6代表99.6%)
  • solved_in — 平均求解时间在几秒钟内
  • is_service_overloaded — 1如果服务超载,则0否则

示例JSON编码的响应:

{ "status": 0, "todays_accuracy": 99.9, "solved_in": 5.3,"is_service_overloaded": false }
Death By Captcha API 还支持令牌身份验证(插座和HTTP),学习如何使用我们的API 使用令牌身份验证.

地位: OK

服务器以比平均响应时间更快的速度全面运行。
  • 平均求解时间
  • -- 秒 - Normal CAPTCHAs (1分钟。前)
  • 48 秒 - reCAPTCHA V2, V3, etc (1分钟。前)
  • -- 秒 - 其他的 (1分钟。前)
Chrome and Firefox logos
可用的浏览器扩展名

更新

  1. Nov 14: RESOLVED - Today we experienced API instability between 18:00hrs & 19:00hrs (GMT-4). The main issue was resolved, so CAPTCHA solving is working as usual, however, there might be some stats anomalies that will shortly be fixed. In the meantime, if you need assistance, contact us at https://deathbycaptcha.com/contact and we'll gladly assist you. We apologize for any inconvenience and appreciate your patience and understanding.
  2. Sep 27: LIMITED WEEK-END PROMOTION! 20% OFF ON 2CHECKOUT PACKAGES IF YOU ORDER BETWEEN SEPT 28 & 29 (GMT-4). Get your CAPTCHAs at https://deathbycaptcha.com/user-pay and then contact us at https://deathbycaptcha.com/contact with your order's detail to claim your freebies!
  3. Sep 13: We experienced a brief login issue today, which has now been resolved. Thank you for your patience and understanding!

  4. 之前的更新…

支持

我们的系统设计为完全用户友好且易于使用。如果您有任何问题,只需发送电子邮件至DBC 技术支持电子邮件com,支持代理将尽快与您联系。

现场支持

周一至周五可用(美国东部标准时间上午 10 点至下午 4 点) Live support image. Link to live support page