1.1.7 • Published 3 years ago

2captcha-rucaptcha v1.1.7

Weekly downloads
39
License
MIT
Repository
github
Last release
3 years ago

Simple 2captcha and rucaptcha API wrapper for Node.js

npm version coverage build

The package is written in TypeScript and currently only supports base64 images.

Instalation

NPM:

npm i 2captcha-rucaptcha --save

Yarn:

yarn add 2captcha-rucaptcha

Usage

All examples are on the github.

Upload image to rucaptcha

const { Captcha } = require("2captcha-rucaptcha");
const fs = require("fs");

const captcha = new Captcha({
  type: 1,
  key: "<YOUR_API_KEY>"
});

const base64 = fs.readFileSync("base64.txt", "utf-8");
captcha
  .solve({ method: "base64", body: base64 })
  .then(result => {
    console.log(result);
  })
  .catch(e => {
    console.log(e);
  });

Upload image to 2captcha

const { Captcha } = require("2captcha-rucaptcha");
const fs = require("fs");

const captcha = new Captcha({
  type: 2,
  key: "<YOUR_API_KEY>"
});

const base64 = fs.readFileSync("base64.txt", "utf-8");
captcha
  .solve({ method: "base64", body: base64 })
  .then(result => {
    console.log(result);
  })
  .catch(e => {
    console.log(e);
  });

Available options to create an instance

NameRequiredDescription
type+1 - rucaptcha2 - 2captcha
key+Your API key
delay-Delay before receiving a captcha recognition response in secondsDefault - 3s

Available options solve()

NameRequiredDescription
method+post (multipart form) or base64 (image base64 encode)
phrase-0 - captcha contains one word1 - captcha contains two or more words
regsense-0 - captcha in not case sensitive1 - captcha is case sensitive
numeric-0 - not specified1 - captcha contains only numbers2 - captcha contains only letters3 - captcha contains only numbers OR only letters4 - captcha contains both numbers AND letters
calc-0 - not specified1 - captcha requires calculation (e.g. type the result 4 + 8 = )
min_len-0 - not specified1..20 - minimal number of symbols in captcha
max_len-0 - not specified1..20 - maximal number of symbols in captcha
language-0 - not specified1 - Cyrillic captcha2 - Latin captcha.
lang-ru, en and etc.
textinstructions-Text will be shown to worker to help him to solve the captcha correctly.
imginstructions-BASE64Image will be shown to worker to help him to solve the captcha correctly.
pingback-URL for pingback (callback) response that will be sent when captcha is solved.URL should be registered on the server.
header_acao-0 - disabled1 - enabled.If enabled in.php will include Access-Control-Allow-Origin:* header in the response.Used for cross-domain AJAX requests in web applications.
softId-ID of software developer

Report bad and good

To report a failed or successful captcha solution, you need to use the following methods:

bad(id)
good(id)

Example:

solution = await captcha.solve({ method: "base64", body: base64, lang: "en", numeric: 1 });
if (ok) captcha.good(captcha.id);
else captcha.bad(captcha.id);

Proxy

Passed to the solve() along with the options above.

NameDescription
proxyFormat for IP authentication: IP_address:PORTExample: proxy=123.123.123.123:3128Format for login/password authentication: login:password@IP_address:PORTExample: proxy=proxyuser:strongPassword@123.123.123.123:3128
proxytypeType of your proxy: HTTP, HTTPS, SOCKS4, SOCKS5.
1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago