Operates with RuCaptcha.com and 2Captcha.com services conveniently.
npm install rucaptcha-2captcha




\




Helps you to operate with [RuCaptcha] or [2Captcha] services conveniently.
Full documentation you can find on official sites: [RuCaptcha Docs][RuCaptchaAPI], [2Captcha Docs][2CaptchaAPI].
rucaptcha-2captcha is available via NPM:bash
$ npm i rucaptcha-2captcha@2.2.1
`Usage
$3
#### Synopsisnew RuCaptcha2Captcha(apiKey[, type]) →
captchaSolver object| Name | Type | Required | Description
|--------|--------------|----------|-
| apiKey | string | yes | Your account API key from settings ([RuCaptcha][RuCaptchaSettings] \| [2Captcha][2CaptchaSettings]).
| type |
2 \| '2' | no | Provide string or number 2 for [2Captcha].
Any other for [RuCaptcha].#### Example
`ts
import RuCaptcha2Captcha from 'rucaptcha-2captcha';const captchaSolver = new RuCaptcha2Captcha();
// or for operating with 2Captcha.com
const captchaSolver = new RuCaptcha2Captcha(, 2);
`$3
#### SynopsiscaptchaSolver.send(params) →
Promise| Name | Type | Required | Description
|--------|--------|----------|-
| params | object | yes | Object with properties from documentation ([RuCaptcha][RuCaptchaParams] \| [2Captcha][2CaptchaParams]),
except:
key, json and soft_id.
Among these properties of url, method, file and body
can be used only the next combinations:
• single url
• method + body
• method + fileUse this method to send captcha for solving.
#### Example
`ts
const id = await captchaSolver.send({
method: 'base64',
body: ,
// any other parameter from documentation,
// except: file, key, json and soft_id
});// id: '4503599627'
`
#### Sending image from your local file system or the Internet
`ts
const id = await captchaSolver.send({
// url: './captchas/W68HP.gif',
url: 'https://user-images.githubusercontent.com/16370704/87232185-aad0b680-c3c5-11ea-8cfc-b769bba631d4.gif',
// any other parameter from documentation,
// except: method, file, body, key, json and soft_id
// for example
regsense: 1, // for case-sensitive
numeric: 4, // for both numbers and letters
min_len: 5, //
max_len: 5, // for exactly 5 symbols
language: 2, // for Roman alphabet
});// id: '4503599672'
`$3
#### SynopsiscaptchaSolver.get(id | ids | strIds) →
Promise | Promise| Name | Type | Required | Description
|--------|-----------|------------|-
| id | string | one of all | Id of sent captcha via send-method.
| ids | Array | one of all | Array of captcha ids.
| strIds | string | one of all | String of comma-separated captcha ids.
Method for getting captcha solutions.\
Returns promise which resolves as soon as all captchas by provided ids will be solved on service.
#### Example
`ts
import { ArrayLikeString, isArrayLikeString } from 'rucaptcha-2captcha/src/types';const id = '';
const id2 = '';
const ids = ',';
const token = await captchaSolver.get(id); // 'pgh3Ds'
const tokens = await captchaSolver.get([id, id2]); // ['pgh3Ds', 'q5ZZpt']
const tokens2 = await captchaSolver.get(ids as ArrayLikeString); // ['pgh3Ds', 'q5ZZpt']
if(isArrayLikeString(ids)) {
const tokens = await captchaSolver.get(ids); // ['pgh3Ds', 'q5ZZpt']
}
`$3
#### SynopsiscaptchaSolver.reportGood(id) →
Promise