DeOne4eg/2captcha-rucaptcha

CAPTCHAFORUM

Administrator
Simple 2captcha and rucaptcha API wrapper for Node.js
The package is written in TypeScript and currently only supports base64 images.
https://githubmemory.com/repo/DeOne4eg/2captcha-rucaptcha

Instalation
NPM:

npm i 2captcha-rucaptcha --save

Yarn:

yarn add 2captcha-rucaptcha

Usage
All examples are on the github.

Upload image to rucaptcha
Code:
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
Code:
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);
  });