- SEASONAL PROMO - As of Jan 24, the hCAPTCHA rate has been decreased to $1.79/1K!!!
Suporte para o reCAPTCHA por Token API (recaptcha v2 e v3)!
NOVO
Agora com suporte para o Novo API reCAPTCHA/noCAPTCHA!
Agora com suporte para o desafios do Geetest!
Novo suporte para Funcaptcha!
Novo suporte para Hcaptcha!
Death By Captcha também oferece suporte para o API DeCaptcher (ambos socket e HTTP), Antigate (Anti-Captcha) e API 2captcha!
O API Death By Captcha também oferece suporte para autenticação de Token (socket e HTTP), Aprenda a utilizar autorização de token com o nosso API
Death By Captcha API
Versão mais recente: 4.6
- .NET (C#, Visual Basic)
- C# Selenium
- AutoIt3
- iMacros
- C (client and libs' source code)
- Java
- Maven
- Java Selenium
- Perl 5+
- PHP v5+
- Python v2.5+ and v3.0+
- Python3 client library from pypi
- Python3 Selenium
- Node.js v8.12.0+
- NodeJS Selenium
- Command-line tool for Windows, Linux (i386 and x86-64) (see usage note below)
Como utilizar nossos clientes API
Baixe o último cliente, adicione-o à sua aplicação e escreva algo de acordo com as linhas abaixo, f.i in PHP:
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
…ou usando token Autenticação em PHP:
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
…ou em C#:
We are using command line dotnet 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 the following comands in the folder whith the README.md file
to run the example:
dotnet new console to create a new project
In your configuration file (it should be something along the lines of
"dbc_api_[version].csproj") add the following line
inside the PropertyGroup tag.
<StartupObject>DeathByCaptcha.[Example]</StartupObject>
Where [Example] is the name of the file with the example you want to run.
So, to run the Funcaptcha example from Funcaptcha.cs
our configuration file should look like this.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<StartupObject>DeathByCaptcha.FuncaptchaExample</StartupObject>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
dotnet build to build the project
dotnet run to run the project
dotnet clean to clean the project
Refer to the .Net SDK help for more information
NOTE: If you find an error during the build, delete your "Program.cs"
file in case it's present in your project.
To build the project with mono
follow the instructions in the Makefile-mono file
…ou usando a autenticação por token em C#:
// 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);
}
}
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
…ou usando Selenium em C#:
We are using command line dotnet 6+
Make sure we already downloaded selenium browser driver
and double check the driver executable is on PATH
We 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
…ou usando Maven:
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
…ou usando Selenium em Java:
We are using Maven 3.6+
Make sure we already downloaded selenium browser driver
and double check the driver executable is on PATH
We 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
…ou usando Selenium em NodeJS:
We are using NodeJS v12+
Make sure we already downloaded selenium browser driver
and double check the driver executable is on PATH
We 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
…ou use a biblioteca de programas de DeathByCaptcha Python3 no pypi :
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.
…ou usando Selenium em Python3
We are using Python v3+
Make sure we already downloaded selenium browser driver
and double check the driver executable is on PATH
We 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
Ao usar os sockets de clientes da API, certifique-se de que não tem ligações TCP de saída para os portos 8123–8130 firewalled. Use os clientes da API HTTP se os clientes API do socket não funcionarem para si. O intervalo de portos 8123–8130 é apenas para API do socket, não tente usá-lo com API HTTP!
Note que uma chamada para a função/método de descodificação pode retornar um valor nulo se o tempo limite for alcançado antes que o CAPTCHA seja resolvido. Se isso acontecer muitas vezes, aumente o tempo limite usado.
Para mais detalhes, veja exemplos incluídos em cada pacote cliente API e verifique o código fonte dos clientes.
Como utilizar a nossa ferramenta de linha de comandos
- Para verificar o seu saldo, execute:
deathbycaptcha.exe -l USERNAME -p PASSWORD -b
Ou usando o token de autenticaçãodeathbycaptcha.exe -a AUTHTOKEN -b
1.O seu saldo será guardado no ficheirobalance.txt
e exibido na saída padrão. - Para carregar um CAPTCHA, execute:
deathbycaptcha.exe -l USERNAME -p PASSWORD -c CAPTCHA_FILE_NAME [-t TIMEOUT]
Ou usando o token de autenticaçãodeathbycaptcha.exe -a AUTHTOKEN -c CAPTCHA_FILE_NAME [-t TIMEOUT]
Tempo de resolução padrão de CAPTCHA é 60 segundos.
2.Se for resolvido,o ID do CAPTCHA será guardado emid.txt
, o texto CAPTCHA será guardado emanswer.txt
, e tanto o ID e o texto serão exibidos na saída padrão separados por um espaço. - Para reportar um CAPTCHA resolvido incorretamente, execute:
deathbycaptcha.exe -l USERNAME -p PASSWORD -n CAPTCHA_ID
Ou usando o token de autenticaçãodeathbycaptcha.exe -a AUTHTOKEN -n CAPTCHA_ID
Detalhes técnicos da API HTTP
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.
Através da nossa API, é possível:
- Carregar um CAPTCHA
- Obtenha uma resposta para um CAPTCHA carregado
- Reportar um CAPTCHA resolvido incorrectamente
- Verificar o saldo de crédito
- Verificar o estado do servidor
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.
Todas as respostas da API são devolvidas com codificação URL por defeito. Se for pretendida codificação JSON, inclua application/json
noheader Accept
do seu pedido. Note que o booleano true será devolvido como 1 em respostas codificadas URL e como true em respostas codificadas JSON. 0 booleano false será devolvido como 0 em respostas codificadas URL e como false em respostas codificadas JSON.
1. Carregar um CAPTCHA
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 aLocation
para obter o status do captcha carregado. Além disso, os seguintes campos serão devolvidos:
captcha
— id do captcha carregadois_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.
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 não ser resolvido ainda! Se não recebeu a resposta na key text da resposta do servidor, você tem que pesquisar por ele. Veja Pesquisa para o estado do CAPTCHA carregado para mais detalhes.
2. Pesquisa para o estado do CAPTCHA carregado
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 banda.
3. Reportar CAPTCHAs solucionados incorrectamente
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 usar a autenticação do token:
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 campois_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!
4. Verificação do saldo de crédito
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 usar a autenticação do token:
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 }
5. Verificar o estado do servidor
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 segundosis_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 }