No commit activity in last 3 years
No release in over 3 years
A simple HTTP client to the DeathByCaptcha API using just RestClient
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
 Project Readme

CaptchedToDeath¶ ↑

CaptchedToDeath is a simple HTTP client for the DeathByCaptcha API written in Ruby. Note that while the DeathByCaptcha service supports both a HTTP API and a Sockets API, this library supports only the former.

By default, all successful CaptchedToDeath responses are JSON-formatted. This cannot be changed yet.

Usage¶ ↑

Some actions require a valid DeathByCaptcha user account credentials, name and password. Some requests to the API will be rejected if they're not provided. Note that also a CaptchedToDeath::NoCreditError exception will be raised if the account has no more credits left on it's balance.

CaptchedToDeath::Client¶ ↑

Initialization of the client can be done in many ways. Beginning with the simplest:

client = CaptchedToDeath::Client.new

Pass the user credentials if you want to decode some CAPTCHA challenges with the remaining credits on your balance.

client = CaptchedToDeath::Client.new('username','password')

Pass a block if you want to set the verbose option, that enables RestClient responses logging (only to STDOUT).

client = CaptchedToDeath::Client.new do |c|
  c.username = 'username'
  c.password = 'password'
  c.verbose  = true
end

Balance checking¶ ↑

With your client initialized using you account credentials, you can check your current balance like so:

client.balance
=> {"is_banned"=>false, "status"=>0, "rate"=>0.139, "balance"=>672.204, "user"=>99999}

Note that the “balance” in the response means your cents left.

CAPTCHA decoding¶ ↑

With your client initialized using you account credentials, you can decode a CAPTCHA challenge if you still have credits left on your account. To do do so, just pass the CAPTCHA image URL:

client.decode('http://i.imgur.com/iWlb4.png')
=> {"status"=>0, "captcha"=>36923242, "is_correct"=>true, "text"=>"jd472tfo"}

Note that only GIF, JPEG and PNG are supported as valid CAPTCHA challenges. Also, the response time depends on the current DeathByCaptcha server load.

CAPTCHA status checking¶ ↑

Once the challenge has already been accepted, it's status can be checked at any time using it's CAPTCHA ID.

client.captcha(36723349)
=> {"status"=>0, "captcha"=>36723349, "is_correct"=>true, "text"=>"jd472tfo"}

CAPTCHA reporting¶ ↑

If you think the result of the challenge decoding is not correct you can report it to get a refund. But mind that you have to report it within the hour of submitting it and that abusing this feature might get you banned.

client.report(36723349)
=> {"status"=>0, "captcha"=>36723349, "is_correct"=>false, "text"=>"jd472tfo"}

CaptchedToDeath::Server¶ ↑

You can check the current status of the DeathByCaptcha server to find out the average decoding time at any particular moment. This time will directly affect the response time of any decoding you submit afterwards.

CaptchedToDeath::Server.status
=> {"status"=>0, "todays_accuracy"=>0.890402, "solved_in"=>13, "is_service_overloaded"=>false}

Contributing¶ ↑

  1. Fork it

  2. Create your feature branch (`git checkout -b my-new-feature`)

  3. Commit your changes (`git commit -am 'Add some feature'`)

  4. Push to the branch (`git push origin my-new-feature`)

  5. Create new Pull Request

License¶ ↑

CaptchedToDeath is released under the MIT License.

Copyright ©2012 Cristian R. Arroyo