Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rucaptcha-2captcha

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rucaptcha-2captcha

Operates with RuCaptcha.com and 2Captcha.com services conveniently.

  • 1.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
616
increased by40.32%
Maintainers
1
Weekly downloads
 
Created
Source

All dependencies Reported vulnerabilities NPM-version Install size Total downloads

rucaptcha-2captcha@1.0.3

Helps you to operate with RuCaptcha or 2Captcha services conveniently.

Full documentation you can find on official sites: RuCaptcha, 2Captcha.

Installation

rucaptcha-2captcha is available via npm:

$ npm i rucaptcha-2captcha@1.0.3

Usage

Initialization

Synopsis

new RuCaptcha2Captcha(apiKey[, type]) → captchaSolver object

ParameterTypeRequiredDescription
apiKeystringtrueYour account API key from settings (RuCaptcha | 2Captcha)
typestringfalseCase insensitive '2captcha' for 2Captcha. Any other for RuCaptcha.
Example
const RuCaptcha2Captcha = require('rucaptcha-2captcha');

const captchaSolver = new RuCaptcha2Captcha(<YOUR_API_KEY>);

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

captchaSolver.send method

Synopsis

captchaSolver.send(params) → Promise<captcha_id>

ParameterTypeRequiredDescription
paramsobjecttrueObject with params from documentation (RuCaptcha | 2Captcha) except key, json and soft_id

Use this method to send captcha for solve.

Example
const id = await captchaSolver.send({
  method: 'base64',
  body: <base64_image_body>,
  // any other parameter from API
  // except: key, json and soft_id
});

// id: '4503599627'

captchaSolver.sendFile custom method over captchaSolver.send

Synopsis

captchaSolver.sendFile(filePath[, params]) → Promise<captcha_id>

ParameterTypeRequiredDescription
filePathstringtruePath to captcha image on your file system
paramsobjectfalseObject with params from documentation (RuCaptcha | 2Captcha) except method, file, body, key, json and soft_id

Use this method to send captcha as image from your local file system.

Example
const id = await captchaSolver.sendFile('./captcha.jpg', {
  min_len: 6,
  max_len: 6,
  regsense: 1,
  numeric: 4,
  // any other parameter from API
  // except: method, file, body, key, json and soft_id
});

// id: '4503599627'

captchaSolver.get method

Synopsis

captchaSolver.get(id | ids | strIds) → Promise<captcha_token> | Promise<Array<captcha_token>>

ParameterTypeRequiredDescription
idstringone of allCaptcha id, sent for solution
idsArrayone of allArray of captcha ids
strIdsstringone of allString of comma separated captcha ids

Method for getting captcha solutions. Returns promise which resolves as soon as captcha (all captchas) will be solved on service.

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

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

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

Solution reporting methods

Synopsis

captchaSolver.reportGood(id) →Promise<Object>
captchaSolver.reportBad(id) →Promise<Object>

ParameterTypeRequiredDescription
idstringtrueCaptcha id, sent for solution

Use these methods for reporting captcha results.
Attention! It's not necessary but better to send reports cause of refund of bad solutions and increasing solving accuracy by reporting good solutions.
Returns some info that was sent from server.

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

captchaSolver.get2 method

Synopsis

captchaSolver.get2(id) → Promise<Object>

ParameterTypeRequiredDescription
idstringtrueCaptcha id, sent for solution

Use captchaSolver.get2 method for getting captcha answer with its cost price.

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

captchaSolver.getBalance method

Synopsis

captchaSolver.captchaSolver.getBalance() → Promise<number>

Use for getting your account balance.
Note: don't use it too often because it decreases your API query limit.

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

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

Testing

No testing functionality provided.


Your improve suggestions and bug reports are welcome any time.

Keywords

FAQs

Package last updated on 04 Jul 2020

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc