Skip to content

dzmitry-duboyski/normal-captcha-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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