Socket
Socket
Sign inDemoInstall

deathbycaptcha

Package Overview
Dependencies
23
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    deathbycaptcha

DeathByCaptcha Node.js client


Version published
Weekly downloads
171
increased by3.64%
Maintainers
1
Install size
1.63 MB
Created
Weekly downloads
 

Readme

Source

DeathByCaptcha.js v0.0.2

Node.js client library for the DeathByCaptcha service.

Installation

DeathByCaptcha.js is available in npm.

npm install deathbycaptcha

Usage

Using the API goes a little something like this:

DeathByCaptcha = require("deathbycaptcha");
var dbc = new DeathByCaptcha("your_dbc_user", "your_dbc_pass");

dbc.solve(fs.readFileSync("/your/captcha/file"), function(err, id, solution) {
	if(err) return console.error(err); // onoes!

	if(solution !== "moo") {
		// It was wrong!
		dbc.report(id, function(err) {
			if(err) return console.error(err); // ONOES!
		});
	}
});

Solve CAPTCHA

Send a CAPTCHA image file to DeathByCaptcha to solve.

DeathByCaptcha.solve(captchaImage, callback);

Callback accepts three parameters:

  • error: if something went wrong sending or solving the CAPTCHA.
  • captchaId: the ID of the CAPTCHA.
  • solution: the solution to the CAPTCHA, as text.

Example:

dbc.solve(fs.readFileSync("/your/captcha/file"), function(err, id, solution) {
	if(err) return console.error(err);
	console.log("CAPTCHA solution is", solution);
});

Get CAPTCHA

Gets a previously solved (or in progress) CAPTCHA by ID. If the CAPTCHA is still in progress the callback will wait for it.

DeathByCaptcha.get(captchaId, callback);

Callback takes 3 arguments:

  • error: if something went wrong.
  • solution: the solution for the CAPTCHA.
  • isCorrect: true/false if the CAPTCHA is "correct" (hasn't beenr reported)

Example:

dbc.get(12345, function(err, solution, isCorrect) {
	if(err) return console.error(err);
	// isComplete is false if the CAPTCHA has been reported (see below).
	console.log("Captcha solution is", solution);
	console.log("Is it correct?", isCorrect);
});

Report CAPTCHA

Use this if you have reason to believe DeathByCaptcha incorrectly solved your CAPTCHA image.

DeathByCaptcha.report(captchaId, callback);

Callback will be handed an error if something went wrong, else nothing will be passed.

Example:

dbc.report(12345, function(err) {
	if(err) return console.error(err);
	console.log("CAPTCHA was reported successfully.")
	console.log("If it wasn't older than an hour, it should have refunded");
});

Get Balance

Loads balance stats for your account from DeathByCaptcha.

DeathByCaptcha.balance(callback);

Callback:

  • error: if something went wrong
  • credits: computed number of CAPTCHA solutions remaining.
  • balance: balance in US cents.
  • rate: cost per solution in US cents.

Example:

dbc.balance(function(err, credits, balance, rate) {
	if(err) return console.error(err);
	console.log(credits + " credits remaining");
	console.log("($" + (balance / 100) + " @ " + rate + "c/solution");
});

Fineprint

deathbycaptcha.js is Copyright (c) 2012 Sam Day

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

See COPYING for more information.

FAQs

Last updated on 27 Jun 2013

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc