Skip to content

Latest commit

 

History

History
37 lines (27 loc) · 981 Bytes

README.md

File metadata and controls

37 lines (27 loc) · 981 Bytes

How to automate an image-based captcha solution in JavaScript

Description

In this example, you can see how automate an image-based captcha solution in JavaScript using Puppeteer and the 2captcha service. Puppeteer is Node.js library using for automation. 2captcha is service used to solve the captcha.

Presetting

Set your API KEY in the file ./index.js#L3

APIKEY=yourApiKey

Usage

npm i

npm run start

Example

  const getCaptchaAnswer = async () => {
    try {
      //send captcha
      const base64Captcha = fs.readFileSync("./image_captcha.png", "base64");
      const res = await solver.imageCaptcha({
        body: base64Captcha,
      });
      return res.data;
    } catch (err) {
      console.log(err);
    }
  };

Screenshot:

imageCaptcha