API

Para fins de automação, Death By Captcha (DBC) fornece APIs para usuários e desenvolvedores integrarem com qualquer software.

O processo de resolução é o seguinte:

Verifique os detalhes de nossa API abaixo para obter informações e recursos adicionais para implementar o DBC usando sua(s) ferramenta(s) favorita(s) e/ou linguagem de programação!

Versão: 4.6

Clientes de terceiros

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
// 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
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.ExampleFuncaptcha"
mvn exec:java -Dexec.mainClass="examples.ExampleHcaptcha"
mvn exec:java -Dexec.mainClass="examples.ExampleRecaptchaV2"
...

Refer to Java and Maven project examples to more detail

Ao usar clientes da Socket API, não se esqueça de ter conexões TCP de saída para as portas 8123-8130 firewalled. Use clientes da API HTTP se os clientes da API de soquete não funcionarem para você. A linha de portas 8123-8130 é apenas para API de soquete, não tente usá-la com a API HTTP!

Observe que uma chamada para a função/método de decodificação pode retornar um valor nulo se o tempo limite for atingido antes que o captcha seja resolvido. Se isso acontecer com frequência, aumente o tempo limite usado.

Para obter mais detalhes, consulte Exemplos incluídos em cada pacote do cliente da API e verifique o código fonte dos clientes.

  1. Para verificar seu saldo, execute:
    deathbycaptcha.exe -l USERNAME -p PASSWORD -b
    Ou usando token de autenticação
    deathbycaptcha.exe -a AUTHTOKEN -b
    Seu saldo será salvo no arquivo balance.txt e impresso na saída padrão.
  2. Para fazer upload de um captcha, execute:
    deathbycaptcha.exe -l USERNAME -p PASSWORD -c CAPTCHA_FILE_NAME [-t TIMEOUT]
    Ou usando token de autenticação
    deathbycaptcha.exe -a AUTHTOKEN -c CAPTCHA_FILE_NAME [-t TIMEOUT]
    O tempo limite de solução de captcha padrão é de 60 segundos.
    Se resolvido, o ID do Captcha será salvo em id.txt , o texto do captcha será salvo em Answer.txt e o ID e o texto serão impressos no Saída padrão separada por um espaço.
  3. Para relatar um captcha resolvido incorretamente, execute:
    deathbycaptcha.exe -l USERNAME -p PASSWORD -n CAPTCHA_ID
    Ou usando token de autenticação
    deathbycaptcha.exe -a AUTHTOKEN -n CAPTCHA_ID

Antes de implementar o seu próprio cliente API HTTP Death By Captcha , por favor considere seriamente a utilização da API socket com um dos nossos clientes oficiais listados acima.

O url da API é http://api.dbcapi.me/api/. O caminho do URL muda dependendo da ação desejada. Todas as respostas dos pedidos feitos à API têm dois campos comuns:

  • status — pedido de status. 0 se não houve erros durante o processamento interno da solicitação, 255 caso contrário.
  • error — breve explicação do erro ocorrido. Só é devolvido quando o status é 255.

Para mais detalhes sobre o caminho correcto do URL e outros campos devolvidos para uma acção específica, consulte a sua secção abaixo.

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.

O que são desafios de “captcha normal”?

Esta forma de CAPTCHA é baseada em imagens e requer a inserção de uma sequência de letras ou números de uma imagem distorcida.

Para carregar um CAPTCHA, faça um pedido POST multipart/form-data para http://api.dbcapi.me/api/captcha. O pedido deve conter os seguintes campos:

  • username — o seu utilizador Death By Captcha.
  • password — a sua palavra-passe Death By Captcha.
  • captchafile — a imagem CAPTCHA.

No caso de estar a usar a autenticação do token:

  • authtoken — o seu token de autenticação Death By Captcha.
  • captchafile — a imagem CAPTCHA.

captchafile deve ser uma imagem raw CAPTCHA, ou uma imagem base64-encoded CAPTCHA com o prefixo base64:. O tamanho do ficheiro da imagem está limitado a menos de 180 KB. Quando a imagem for codificada em base64, o tamanho deve ser menor do que 120 KB. Os formatos de imagem suportados são JPG, PNG, GIF e BMP.

Aqui está o form HTML que faz o truque:

<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>

Ou usar a autenticação do token:

<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>

Aqui está o equivalente de comando cURL:

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

Ou usar a autenticação do token:

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

O campo base64-encoded captchafile deve ficar assim:

base64:R0lGODlhAQABAIABAAAAAP///yH5BAEAAAEALAAAAAABAAEAAAICTAEAOw==

Terá uma das seguintes respostas HTTP:

  • 303 See Other se o seu CAPTCHA foi carregado com sucesso, Location O cabeçalho HTTP irá indicar-lhe a página de status do CAPTCHA enviado; poderá seguir a Location para obter o status do captcha carregado. Além disso, os seguintes campos serão devolvidos:
    • captcha — id do captcha carregado
    • is_correct — 1 se uma resposta foi identificada para este captcha ou ainda está a ser processada, 0 se o processamento terminou e nenhuma resposta pôde ser encontrada.
    • text — oesposta do captcha. Uma string vazia significa que o captcha ainda não está resolvido.
    Exemplo codificado por URL:
    status=0&captcha=123&is_correct=1&text=
    Exemplo codificado JSON:
    { "status": 0, "captcha": 123, "is_correct": 1, "text": "" }
  • 403 Forbidden se as credenciais Death By Captcha foram rejeitadas, ou não tem créditos suficientes.
  • 400 Bad Request se o seu pedido não seguiu a especificação acima, ou o CAPTCHA foi rejeitado por não ser uma imagem válida.
  • 500 Internal Server Error se algo aconteceu do nosso lado impedindo-o de carregar o CAPTCHA; se tiver a certeza de que está a enviar pedidos devidamente estruturados com imagens CAPTCHA válidas, mas o problema persiste, por favor contacte o nosso apoio ao vivo e diga-lhes em detalhes como reproduzir o problema.
  • 503 Service Temporarily Unavailable quando o nosso serviço estiver sobrecarregado, tente novamente mais tarde.

Neste momento, o CAPTCHA que você acabou de carregar pode ainda não ter sido resolvido! Se não recebeu a resposta na chave text da resposta do servidor, você terá que pesquisar por ela. Consulte Pesquisando pelo estado do CAPTCHA carregado para mais detalhes.

Para obter o status de um CAPTCHA carregado, faça um pedido GET para http://api.dbcapi.me/api/captcha/%CAPTCHA_ID%, onde %CAPTCHA_ID% é o ID do CAPTCHA carregado adquirido enquanto carrega o CAPTCHA. Não tens de fornecer as suas crendenciais Death By Captcha desta vez. A resposta será HTTP HTTP 200 OK com os mesmos campos descritos para a resposta 303 See Other da secção Carregar um CAPTCHA.

Se o captcha ainda não estiver resolvido, a key text virá vazia. Terá de continuar a fazer pesquisas para obter esta resposta. Exemplos de respostas:

  • Resposta codificada URL de um CAPTCHA resolvido correctamente
    status=0&captcha=1234&is_correct=1&text=tyrone+slothrop
  • Resposta codificada JSON de um CAPTCHA resolvido correctamente
    { "captcha": 1234, "is_correct": true,"status": 0, "text": "tyrone slothrop" }
  • Resposta codificada JSON de um CAPTCHA resolvido incorrectamente
    { "captcha": 1234, "is_correct": false, "status": 0, "text": "?" }
  • Resposta codificada JSON de um CAPTCHA inexistente
    { "captcha": 0, "status": 0 }
    Se você receber esta resposta, confirme que o ID CAPTCHA que está a usar para pesquisar a resposta é o mesmo retornado quando foi carregado. Se o problema persistir, por favor contacte-nos.

Por favor não pesquise o status de CAPTCHA mais do que uma vez em alguns segundos.
Isto é considerado abusivo e pode fazer com que seja banido.
Poupe a sua e a nossa largura de bandae.

Se acha que o CAPTCHA foi resolvido incorrectamente, reporte-o à Death By Captcha para recuperar o seu dinheiro. Para isso, faça um pedido POST para http://api.dbcapi.me/api/captcha/%CAPTCHA_ID%/report com os seguintes campos:

  • username — o seu utilizador Death By Captcha.
  • password — a sua palavra-passe Death By Captcha.

Ou usando token de autenticação:

  • authtoken — o seu token de autenticação Death By Captcha.

A resposta será:

  • 200 OK se reportou com sucesso. Neste caso, os seus créditos serão reembolsados. O corpo de resposta será o mesmo que para uma pesquisa (ou carregamento), mas o campo is_correct será 0. Exemplo:
    { "captcha": 1234, "is_correct": false,"status": 0, "text": "tyrone slothrop" }
  • 503 Service Unavailable e não for possível completar o que reportou. Isso pode ser porque:
    1) o captcha correspondente ao id fornecido não foi carregado pelo utilizador que o reportou;
    2) o seu utilizador está banido;
    3) foi reportado mais de uma hora depois de ter sido carregado. Neste caso, não será reembolsado.

Abusar desta funcionalidade vai fazer com que seja banido!

Para verificar o seu saldo de crédito, faça um pedido de GET ou POST para http://api.dbcapi.me/api com os seguintes campos:

  • username — o seu utilizador Death By Captcha.
  • password — a sua palavra-passe Death By Captcha.

Ou usando token de autenticação:

  • authtoken — o seu token de autenticação Death By Captcha.

Numa autenticação bem sucedida, você vai obter uma resposta 200 OK com os detalhes da sua conta Death By Captcha, codificados em URL ou JSON, com os seguintes campos:

  • user — o ID da sua conta Death By Captcha;
  • rate — quanto lhe cobramos por um CAPTCHA resolvido correctamente, em US¢;
  • balance — o seu saldo de crédito actual, em US¢.
  • is_banned — 1 se o utilizador estiver banido, 0 caso contrário.

Exemplo de resposta codificada por JSON:

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

Para receber o estado actual do servidor, envie um pedido GET para http://api.dbcapi.me/api/status. A resposta terá os seguintes campos:

  • todays_accuracy — número que representa a precisão em percentagem (por exemplo, 99,6 representa 99,6%)
  • solved_in — tempo médio de resolução em segundos
  • is_service_overloaded — 1 Se o serviço estiver sobrecarregado, 0 caso contrário

Exemplo de resposta codificada por JSON:

{ "status": 0, "todays_accuracy": 99.9, "solved_in": 5.3,"is_service_overloaded": false }
Death By Captcha API também suporta autenticação de token (soquete e http), Aprenda a usar a autenticação de token com nossa API .

Status: OK

Os servidores estão totalmente operacionais com tempo de resposta mais rápido que a média.
  • Tempo médio de resolução
  • 5 segundos - Normal CAPTCHAs (1 min. atrás)
  • 25 segundos - reCAPTCHA V2, V3, etc (1 min. atrás)
  • 23 segundos - hCAPTCHA & outros (1 min. atrás)
Chrome and Firefox logos
Extensões do navegador disponíveis

Atualizações

  1. Feb 26: NEW TYPE ADDED - Now supporting Friendly CAPTCHA!! See the details at https://deathbycaptcha.com/api/friendly
  2. Nov 22: Now supporting Amazon WAF!! See the details at https://deathbycaptcha.com/api/amazonwaf
  3. Nov 01: Today our Socket API was affected by a technical issue for a few hours. It's now sorted and back to 100%, working optimally. We sincerely apologize for the inconvenience this may have caused you. If you were affected, please don't hesitate to contact us: https://deathbycaptcha.com/contact and we'll be happy to assist/compensate you!

  4. Atualizações anteriores…

Apoiar

Nosso sistema foi projetado para ser totalmente amigável e fácil de usar. Se você tiver algum problema com isso, basta enviar um e-mail paraE-mail de suporte técnico DBC com, e um agente de suporte entrará em contato com você o mais rápido possível.

Suporte ao vivo

Disponível de segunda a sexta-feira (10h às 16h EST) Live support image. Link to live support page