Índice

Descargue los códigos de ejemplo basados en el cliente API:

Nuevo soporte de API de reconocimiento de audio

¿Cuáles son los desafíos del "reconocimiento de audio"?

Los CAPTCHA de reconocimiento de audio son desafíos que generalmente requieren que el usuario escuche un clip de audio e ingrese correctamente la serie de letras o números que escuchan.

Para su conveniencia, implementamos soporte para la API de reconocimiento de audio. Si su software funciona con él y admite una configuración mínima, debería poder decodificar audios usando Death By Captcha en poco tiempo.

  • Audio Recognition API: Proporcionando la cadena Base64 del archivo de audio y el idioma, la API devuelve el texto del audio que usará para enviar el formulario en la página con el desafío de audio.

Precios

Por el momento, el precio es de $0.59 por cada 1,000 desafíos de reconocimiento de audio resueltos correctamente. No se le cobrará por los audios informados como resueltos incorrectamente. Tenga en cuenta que esta tarifa se aplica solo a los nuevos desafíos de reconocimiento de audio, por lo que solo los clientes que utilicen esta API específica serán cobrados a dicha tarifa.

API de reconocimiento de audio Preguntas frecuentes:

¿Cuál es la URL de API de reconocimiento de audio?

Para usar la API de reconocimiento de audio deberá enviar una solicitud de publicación HTTP a http://api.dbcapi.me/api/captcha

¿Cuáles son los parámetros de publicación para la API de reconocimiento de audio?

  • username: El nombre de usuario de su cuenta de DBC
  • password: La contraseña de su cuenta de DBC
  • type=13: El tipo 13 especifica que este es un API de reconocimiento de audio
  • audio: Cadena codificada Base64 que representa los datos del archivo de audio. Actualmente admitimos solo el formato mp3.
  • language: El lenguaje detectado del contenido de audio. Los idiomas compatibles son: en, fr, de, el, pt, ru

  • Ejemplo de audio de cadena codificado Base64:

    
    UklGRiQAAABXQVZFZm10IBAAAAABAAEAIlYAAESsAAACABAAZGF0YQQAAAAA
                

¿Qué idiomas son compatibles con la API de reconocimiento de audio?

Los idiomas compatibles se muestran en la tabla a continuación.

Código de idioma ( parámetro de idioma ) Nombre del lenguaje
en English
fr French
de German
el Greek
pt Portuguese
ru Russian
¿Cuál es la respuesta de la API de reconocimiento de audio?

La respuesta de la API de reconocimiento de audio sigue la estructura descrita a continuación. Será en forma de una cadena, como se muestra en el ejemplo a continuación:


"This is an example response from the Audio Recognition API."
      

Uso de API de reconocimiento de audio con clientes API:


    /**
     * Death by Captcha PHP API Audio usage example
     *
     * @package DBCAPI
     * @subpackage PHP
     */

    /**
     * DBC API clients
     */
    require_once '../deathbycaptcha.php';

    $username = "username";  // DBC account username
    $password = "password";  // DBC account password
    $token_from_panel = "your-token-from-panel";  // DBC account authtoken

    // Use DeathByCaptcha_SocketClient() class if you want to use SOCKET API.
    $client = new DeathByCaptcha_HttpClient($username, $password);
    $client->is_verbose = true;

    // To use token the first parameter must be authtoken.
    // $client = new DeathByCaptcha_HttpClient("authtoken", $token_from_panel);

    echo "Your balance is {$client->balance} US cents\n";

    // Read the audio file and get the base64 encoded string
    try {
      $fileData = file_get_contents("images/audio.mp3");
      $base64Data = base64_encode($fileData);
    } catch (Exception $e) {
      echo 'An error occurred while reading the file: ',  $e->getMessage(), "\n";
    }

    //Put the type, the audio base64 string and the language
    $extra = [
      'type' => 13,
      'audio' => $base64Data,
      'language' => "en"
    ];

    // Put null the first parameter and add the extra payload
    if ($captcha = $client->decode(null, $extra)) {
        echo "CAPTCHA {$captcha['captcha']} uploaded\n";

        sleep(DeathByCaptcha_Client::DEFAULT_TIMEOUT);

        // Poll for CAPTCHA indexes:
        if ($text = $client->get_text($captcha['captcha'])) {
            echo "CAPTCHA {$captcha['captcha']} solved: {$text}\n";

            // Report an incorrectly solved CAPTCHA.
            // Make sure the CAPTCHA was in fact incorrectly solved!
            //$client->report($captcha['captcha']);
        }
    }
        

    # audio
    import deathbycaptcha
    import json
    import base64

    # Put your DBC account username and password here.
    username = "username"
    password = "password"

    # you can use authtoken instead of user/password combination
    # activate and get the authtoken from DBC users panel
    authtoken = "authtoken"

    # to use socket client
    # client = deathbycaptcha.SocketClient(username, password)

    # to use authtoken
    # client = deathbycaptcha.SocketClient(username, password, authtoken)

    client = deathbycaptcha.HttpClient(username, password)

    # Read the audio file and get the base64 string
    try:
      with open('images/audio.mp3', 'rb') as file:
        audio_data = file.read()
        base_string = base64.b64encode(audio_data).decode()
    except Exception as e:
      print("An error occurred while converting the file to base64: " + str(e))

    try:
        balance = client.get_balance()
        print(balance)

        # Put your CAPTCHA type, the base64 string and the language:
        captcha = client.decode(type=13, audio=base_string, language="en")
        if captcha:
            # The CAPTCHA was solved; captcha["captcha"] item holds its
            # numeric ID, and captcha["text"] its text token solution.
            print("CAPTCHA %s solved: %s" % (captcha["captcha"], captcha["text"]))

            if '':  # check if the CAPTCHA was incorrectly solved
                client.report(captcha["captcha"])

    except deathbycaptcha.AccessDeniedException:
        # Access to DBC API denied, check your credentials and/or balance
        print("error: Access to DBC API denied, check your credentials and/or balance")

        

    import com.DeathByCaptcha.AccessDeniedException;
    import com.DeathByCaptcha.Client;
    import com.DeathByCaptcha.HttpClient;
    import com.DeathByCaptcha.SocketClient;
    import com.DeathByCaptcha.Captcha;
    import org.json.JSONObject;

    import java.util.Base64;
    import java.nio.file.Files; 
    import java.nio.file.Paths;
    import java.io.IOException;

    class ExampleAudioCaptcha {
        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 authtoken = "your_authtoken_here";

            // The path to the audio file
            String filePath = "images/audio.mp3";
            String encodedString = null;

            // Read the audio file and encode the file to base64
            try {
              byte[] fileContent = Files.readAllBytes(Paths.get(filePath));
              encodedString = Base64.getEncoder().encodeToString(fileContent);
            } catch (IOException e) {
              e.printStackTrace();
            }

            String audio = encodedString;
            String language = "en";

            /* Death By Captcha Socket Client
               Client client = (Client) (new SocketClient(username, password));
               Death By Captcha http Client */
            Client client = (Client) (new HttpClient(username, password));
            client.isVerbose = true;

            /* Using authtoken
               Client client = (Client) new HttpClient(authtoken); */

            try {
                try {
                    System.out.println("Your balance is " + 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 with 120 seconds timeout.
                      Put you CAPTCHA audio file base64 encoded, the language and solving
                      timeout (in seconds) if 0 the default value take place.
                      please note we are specifying type=13 */
                    captcha = client.decode(13, audio, language);
                } catch (IOException e) {
                    System.out.println("Failed uploading CAPTCHA");
                    return;
                }
                if (null != captcha) {
                    System.out.println("CAPTCHA " + 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(
                                "Failed reporting incorrectly solved CAPTCHA");
                        }
                    } catch (IOException e) {
                        System.out.println(
                           "Failed reporting incorrectly solved CAPTCHA:" + e.toString());
                    }*/
                } else {
                    System.out.println("Failed solving CAPTCHA");
                }
            } catch (com.DeathByCaptcha.Exception e) {
                System.out.println(e);
            }


        }
    }

        

    // audio

    using System;
    using System.IO;
    using System.Collections;
    using DeathByCaptcha;

    namespace DBC_Examples.examples
    {
        public class AudioExample
        {
            public void Main()
            {
                // Put your DeathByCaptcha account username and password here.
                string username = "your username";
                string password = "your password";
                // string token_from_panel = "your-token-from-panel";

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

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

                // Read the audio file and convert it to base64 string
                string base64String = null;
                try
                {
                  byte[] fileBytes = File.ReadAllBytes("images/audio.mp3");
                  base64String = Convert.ToBase64String(fileBytes);
                }
                catch (Exception ex)
                {
                  Console.WriteLine("An error occurred while converting the file to base64: " + ex.Message);
                }
                
                try
                {
                    double balance = client.GetBalance();

                    /* Upload a CAPTCHA and poll for its status. Put the audio base64 string,
                      the language, CAPTCHA type and desired solving timeout (in seconds)
                      here. If solved, you'll receive a DeathByCaptcha.Captcha object. */
                    Captcha captcha = client.Decode(Client.DefaultTimeout,
                        new Hashtable()
                        {
                            {"type", 13},
                            {"language", "en"},
                            {"audio", base64String}
                        });

                    if (null != captcha)
                    {
                        /* The CAPTCHA was solved; captcha.Id property holds
                        its numeric ID, and captcha.Text holds its text. */
                        Console.WriteLine("CAPTCHA {0} solved: {1}",
                            captcha.Id, captcha.Text);

    //                  if ( /* check if the CAPTCHA was incorrectly solved */)
    //                  {
    //                      client.Report(captcha);
    //                  }
                    }
                }
                catch (AccessDeniedException e)
                {
                    /* Access to DBC API denied,
                                check your credentials and/or balance */
                    Console.WriteLine("<<< catch : " + e.ToString());
                }
            }
        }
    }

        

    Imports System
    Imports System.IO
    Imports System.Threading
    Imports System.Collections

    Imports DeathByCaptcha

    Public Class Audio
        Sub Main(args As String())

            ' Put your DBC username & password or authtoken here:
            Dim username = "username"
            Dim password = "password"
            Dim token_from_panel = "your-token-from-panel"

            ' DBC Socket API client
            ' Dim client As New SocketClient(username, password)
            ' DBC HTTP API client
            Dim client As New HttpClient(username, password)

            ' To use token auth the first parameter must be "authtoken"
            ' Dim client As New HttpClient("authtoken", token_from_panel)

            ' Read the audio file and convert it to base64 string
            Dim base64String As String = Nothing
            Try
              Dim fileBytes As Byte() = File.ReadAllBytes("images/audio.mp3")
              base64String = Convert.ToBase64String(fileBytes)
            Catch ex As System.Exception
              Console.WriteLine("An error occurred while converting the file to base64: " & ex.Message)
            End Try

            Console.WriteLine(String.Format("Your balance is {0,2:f} US cents",
                                            client.Balance))

            ' Create the payload with the type and the data
            Dim extraData As New Hashtable()
            extraData.Add("type", 13)
            extraData.Add("language", "en")
            extraData.Add("audio", base64String)

            ' Upload a CAPTCHA and poll for its status. Put the Audio
            ' parameters, CAPTCHA type and desired solving timeout (in seconds)
            ' here. If solved, you'll receive a DeathByCaptcha.Captcha object.
            Dim captcha As Captcha = client.Decode(
                                    DeathByCaptcha.Client.DefaultTimeout, extraData)
            If captcha IsNot Nothing Then
                Console.WriteLine(String.Format("CAPTCHA {0:d} solved: {1}",
                                                captcha.Id, captcha.Text))

                ' Report an incorrectly solved CAPTCHA.
                ' Make sure the CAPTCHA was in fact incorrectly solved, do not
                ' just report it at random, or you might be banned as abuser.
                ' If client.Report(captcha) Then
                '    Console.WriteLine("Reported as incorrectly solved")
                ' Else
                '    Console.WriteLine("Failed reporting as incorrectly solved")
                ' End If
            End If
        End Sub
    End
        

    /*
    * Death by Captcha Node.js API Audio usage example
    */

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

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

    // Read the audio file and convert it to base64 string
    let base64String = null;
    try {
      const fileData = fs.readFileSync('images/audio.mp3');
      base64String = fileData.toString('base64');
    } catch (error) {
      console.error('An error occurred while reading the file:', error);
    }

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

    // 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 with type 13 & audio base64 string & language
    client.decode({extra: {type: 13, audio: base64String, language: "en"}}, (captcha) => {

        if (captcha) {
            console.log('Captcha ' + 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);
            * });
            */
        }

    });
        

Estado: Carga alta

Los servidores están completamente operativos, pero el tiempo de respuesta puede ser, temporalmente, más alto que el promedio.
  • Tiempo medio de resolución
  • 2 segundos - Normal CAPTCHAs (1 min. atrás)
  • 34 segundos - reCAPTCHA V2, V3, etc (1 min. atrás)
  • 14 segundos - hCAPTCHA & otros (1 min. atrás)
Chrome and Firefox logos
Extensiones de navegador disponibles

Actualizaciones

  1. Apr 26: RESOLVED - The deathbycaptcha.com website (the API remained/remains fully functional) was sporadically inaccessible due to network issues on April 25th & 26th. This situation was fully resolved and everything is back to 100%.
  2. Feb 26: NEW TYPE ADDED - Now supporting Friendly CAPTCHA!! See the details at https://deathbycaptcha.com/api/friendly
  3. Nov 22: Now supporting Amazon WAF!! See the details at https://deathbycaptcha.com/api/amazonwaf

  4. Actualizaciones anteriores…

Apoyo

Nuestro sistema está diseñado para ser completamente fácil de usar. Si tiene algún problema con él, simplemente envíenos un correo electrónico a Correo electrónico de soporte técnico de DBC com, y un agente de soporte se comunicará con usted lo antes posible.

Soporte en vivo

Disponible de lunes a viernes (10 am a 4 pm EST) Live support image. Link to live support page