rucaptcha-2captcha@1.0.2
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
rucaptcha-2captcha
is available via npm:
$ npm i rucaptcha-2captcha@1.0.2
Usage
Initialization
const RuCaptcha2Captcha = require('rucaptcha-2captcha');
const captchaSolver = new RuCaptcha2Captcha(<YOUR_API_KEY>);
const captchaSolver = new RuCaptcha2Captcha(<YOUR_API_KEY>, '2captcha');
<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>,
});
captchaSolver.sendFile method
Use this method to send captcha as image from your local 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,
});
captchaSolver.get method
Method for getting captcha solutions. 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);
const tokens = await catpchaSolver.get([id1, id2, ...]);
const tokens = await catpchaSolver.get('<id1>,<id2>,...');
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 solutions and increasing solving accuracy by reporting good solutions.
const result = await catpchaSolver.reportGood(id);
const result = await catpchaSolver.reportBad(id);
captchaSolver.get2 method
Use captchaSolver.get2 method for getting captcha answer with its cost price. Returns Promise<Object>
.
const info = await catpchaSolver.get2(id);
captchaSolver.getBalance method
Use for getting your account balance.
const balance = await catpchaSolver.getBalance();
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.