# 2captcha-rucaptcha

> Simple 2captcha and rucaptcha API wrapper for Node.js

Latest version **1.1.7** (published 2019-10-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install 2captcha-rucaptcha
pnpm add 2captcha-rucaptcha
yarn add 2captcha-rucaptcha
bun add 2captcha-rucaptcha
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.7 |
| Published | 2019-10-06 |
| First published | 2019-10-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 15.6 KB |
| Known vulnerabilities | 0 (+25 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 3 |
| Author | DeOne |
| Maintainers | deone |
| Keywords | 2captcha, 2captcha.com, rucaptcha, rucaptcha.com |

## Links

- npm: https://www.npmjs.com/package/2captcha-rucaptcha
- Repository: https://github.com/DeOne4eg/2captcha-rucaptcha
- Homepage: https://github.com/DeOne4eg/2captcha-rucaptcha#readme
- Issues: https://github.com/DeOne4eg/2captcha-rucaptcha/issues
- npm.io page: https://npm.io/package/2captcha-rucaptcha

## Dependencies (2)

- [axios](https://npm.io/package/axios.md) ^0.19.0
- [delay](https://npm.io/package/delay.md) ^4.3.0

## Recent versions

- 1.1.7 (latest) — 2019-10-06
- 1.1.6 — 2019-10-05
- 1.1.5 — 2019-10-03
- 1.1.4 — 2019-10-03
- 1.1.3 — 2019-10-03
- 1.1.1 — 2019-10-03
- 1.1.0 — 2019-10-03
- 1.0.9 — 2019-10-03
- 1.0.8 — 2019-10-03
- 1.0.7 — 2019-10-03
- 1.0.6 — 2019-10-03
- 1.0.5 — 2019-10-03
- 1.0.4 — 2019-10-03
- 1.0.3 — 2019-10-03
- 1.0.1 — 2019-10-02
- … 1 more at https://npm.io/package/2captcha-rucaptcha/versions

## README

# Simple 2captcha and rucaptcha API wrapper for Node.js

[![npm version](https://img.shields.io/static/v1?label=npm&message=v1.1.7&color=brightgreen)](https://www.npmjs.com/package/2captcha-rucaptcha)
[![coverage](https://img.shields.io/static/v1?label=coverage&message=100%&color=blue)](https://www.npmjs.com/package/2captcha-rucaptcha)
[![build](https://img.shields.io/static/v1?label=build&message=passing&color=green)](https://www.npmjs.com/package/2captcha-rucaptcha)

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

## Instalation

NPM:

```bash
npm i 2captcha-rucaptcha --save
```

Yarn:

```bash
yarn add 2captcha-rucaptcha
```

## Usage

All examples are on the github.

### Upload image to rucaptcha

```typescript
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

```typescript
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

| Name  | Required | Description                                                                      |
| ----- | :------: | -------------------------------------------------------------------------------- |
| type  |    +     | 1 - rucaptcha<br>2 - 2captcha                                                    |
| key   |    +     | Your API key                                                                     |
| delay |    -     | Delay before receiving a captcha recognition response in seconds<br>Default - 3s |

### Available options solve()

| Name             | Required | Description                                                                                                                                                                                       |
| ---------------- | :------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| method           |    +     | post (multipart form) or base64 (image base64 encode)                                                                                                                                             |
| phrase           |    -     | 0 - captcha contains one word<br>1 - captcha contains two or more words                                                                                                                           |
| regsense         |    -     | 0 - captcha in not case sensitive<br>1 - captcha is case sensitive                                                                                                                                |
| numeric          |    -     | 0 - not specified<br>1 - captcha contains only numbers<br>2 - captcha contains only letters<br>3 - captcha contains only numbers OR only letters<br>4 - captcha contains both numbers AND letters |
| calc             |    -     | 0 - not specified<br>1 - captcha requires calculation (e.g. type the result 4 + 8 = )                                                                                                             |
| min_len          |    -     | 0 - not specified<br>1..20 - minimal number of symbols in captcha                                                                                                                                 |
| max_len          |    -     | 0 - not specified<br>1..20 - maximal number of symbols in captcha                                                                                                                                 |
| language         |    -     | 0 - not specified<br>1 - Cyrillic captcha<br>2 - Latin captcha.                                                                                                                                   |
| lang             |    -     | ru, en and etc.                                                                                                                                                                                   |
| textinstructions |    -     | Text will be shown to worker to help him to solve the captcha correctly.                                                                                                                          |
| imginstructions  |    -     | BASE64<br>Image 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.<br>URL should be registered on the server.                                                                         |
| header_acao      |    -     | 0 - disabled<br>1 - enabled.<br>If enabled in.php will include Access-Control-Allow-Origin:\* header in the response.<br>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: 

```typescript
bad(id)
good(id)
```

#### Example:

```typescript
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.

| Name      | Description                                                                                                                                                                                                                      |
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| proxy     | Format for IP authentication: IP_address:PORT<br>Example: proxy=123.123.123.123:3128<br>Format for login/password authentication: login:password@IP_address:PORT<br>Example: proxy=proxyuser:strongPassword@123.123.123.123:3128 |
| proxytype | Type of your proxy: HTTP, HTTPS, SOCKS4, SOCKS5.                                                                                                                                                                                 |

---
_Source: https://npm.io/package/2captcha-rucaptcha · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
