DeathbyCaptcha API Example

johnjohn123

Registered Member
Joined
Jun 19, 2012
Messages
68
Reaction score
28
Okay so basically I need to use deathbycaptcha's service to break some captchas but I can't really figure out how to use their API. They have an autoit API client that is provided to use but I don't know how to use it.

So far I have my bot designed such that once it gets to a captcha, it will save the captcha image to the c drive. Let's just say it saves the captcha image to "c:/image.jpg" for the sake of this explanation. So now I have the image and I need it sent to deathbycaptcha's service to get solved and need the result returned back into a variable so I can solve the captcha.

Here is an excerpt code sample:

Code:
; Usage example
; =============
;
; Call DeathByCaptchaDecode() function with your DBC username, password,
; CAPTCHA file name, and desired solving timeout (in seconds) as arguments.
; You'll receive an array of two elements: numeric CAPTCHA ID and its text;
; CAPTCHA ID will be greater than zero if the CAPTCHA was solved.
;
$result = DeathByCaptchaDecode($CmdLine[1], $CmdLine[2], $CmdLine[3], 60)
MsgBox(0, "decode()", StringFormat('ID: %s, text: %s', $result[0], $result[1]))

Where exactly do I put my DBC username, password and captcha filename? Lets just say my username is "123" password "123" and as above the file name is "c:/image.jpg". The whole $CmdLine[1] is what is throwing me off.
 
Last edited:
Also here is the function that is being called for reference. I don't think I have to modify anything in this part of the code. Just listing it as a reference.

; Decodes a CAPTCHA by uploading it and polling for its status repeatedly.; Call with your DeathByCaptcha username/password, CAPTCHA file name and
; solving timeout (in seconds). Returns an two-elements array with CAPTCHA
; unique ID (zero if not solved) and text (empty string if not solved).
; Removes unsolved CAPTCHAs automatically.

Func DeathByCaptchaDecode($username, $password, $captchaFileName, $timeout)
Local $result[2] = [0, ""]
$result[0] = DeathByCaptchaUpload($username, $password, $captchaFileName)
If 0 < $result[0] Then
Local $deadline = $timeout * 1000
While 0 = StringLen($result[1]) AND 0 < $deadline
Sleep(10000)
$deadline -= 10000
$result[1] = DeathByCaptchaGetText($result[0])
WEnd
If 0 = StringLen($result[1]) Then
$result[0] = 0
EndIf
EndIf
Return $result
EndFunc
 
Just watch the function declaration: Func DeathByCaptchaDecode($username, $password, $captchaFileName, $timeout)

So you can know what parameters you have to enter into your call:
$result = DeathByCaptchaDecode($CmdLine[1], $CmdLine[2], $CmdLine[3], 60)

Username: $CmdLine[1]
Password: $CmdLine[2]
Image File name: $CmdLine[3]

How are you calling the function and what message you get back?
 
Back
Top