1.0.0 • Published 4 years ago

rucaptcha2captcha v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

All dependencies Reported vulnerabilities NPM-version Install size Total downloads

ru-captcha@1.0.0

Helps you to operate with RuCaptcha or 2Captcha conveniently.

Full documentation you can find on https://rucaptcha.com/api-rucaptcha and https://2captcha.com/2captcha-api respectively.

Installation

ru-captcha is available via npm:

$ npm i ru-captcha@1.0.0

Usage

Initialization

const RuCaptcha = require('RuCaptcha');

const captchaSolver = new RuCaptcha(<YOUR_API_KEY>);
// or new RuCaptcha(<YOUR_API_KEY>, '2captcha') for operating with 2Captcha.com

<YOUR_API_KEY> you can find in your account settings (RuCaptcha | 2Captcha)

captchaSolver.send method

Use this method to send captcha for solve. Returns Promise<capthca_id>. For example:

const id = await captchaSolver.send({
  method: 'base64',
  body: <base64_image_body>,
});

// id: '4503599627'

captchaSolver.sendFile method

Use this method to send captcha as image from your file system. Returns Promise<capthca_id>. For example:

const id = await captchaSolver.sendFile('./captcha.jpg', {
  min_len: 6,
  max_len: 6,
  regsense: 1,
  numeric: 4,
});

// id: '4503599627'

captchaSolver.get method

Method for getting captcha answers. Returns Promise<captcha_token> or Promise<Array<captcha_token>> which resolves as soon as captcha(s) will be solved on service.

  const token = await catpchaSolver.get(id);
  // token: 'ABCD'


  // or
  const tokens = await catpchaSolver.get([id1, id2, ...]);
  // tokens: ['ABCD', 'abcd', ...]

  // or
  const tokens = await catpchaSolver.get('<id1>,<id2>,...');
  // tokens: ['ABCD', 'abcd', ...]

captchaSolver.reportGood and captchaSolver.reportBad methods

Use these methods for reporting captcha results. It's not necessary but better to send reports cause of refund of bad solves and increasing solving accuracy by reporting good solves.

  const result = await catpchaSolver.reportGood(id);
  // or
  const result = await catpchaSolver.reportBad(id);
  // result: { status: 1, request: 'OK_REPORT_RECORDED' }

captchaSolver.get2 method

Use captchaSolver.get2 method for getting captcha answer with its price. Returns Promise<captcha_token>.

  const info = await catpchaSolver.get2(id);
  // info: { request: '6p6pck', price: '0.034' }

captchaSolver.getBalance method

Use for getting your account balance.

  const balance = await catpchaSolver.getBalance();
  // balance: 50.034

Note: don't use it too often because it decreases your query limit to RuCaptcha (2Captcha) server.


Note that json, key and soft_id are not writable parameters of any method.

More info you can find in documentation (RuCaptcha | 2Captcha).

Testing

No testing functionality provided.


Your improve suggestions and bug reports are welcome any time.