puppeteer-extra-plugin-recaptcha v3.4.0

CAPTCHAFORUM

Administrator
SWrIQw0[1].gif


A puppeteer-extra plugin to solve reCAPTCHAs and hCaptchas automatically.

Install
yarn add puppeteer-extra-plugin-recaptcha
# - or -
npm install puppeteer-extra-plugin-recaptcha
If this is your first puppeteer-extra plugin here's everything you need:

yarn add puppeteer puppeteer-extra puppeteer-extra-plugin-recaptcha
# - or -
npm install puppeteer puppeteer-extra puppeteer-extra-plugin-recaptcha

Usage
The plugin essentially provides a mighty page.solveRecaptchas() method that does everything needed automagically.
Code:
// puppeteer-extra is a drop-in replacement for puppeteer,

// it augments the installed puppeteer with plugin functionality

const puppeteer = require('puppeteer-extra')



// add recaptcha plugin and provide it your 2captcha token (= their apiKey)

// 2captcha is the builtin solution provider but others would work as well.

// Please note: You need to add funds to your 2captcha account for this to work

const RecaptchaPlugin = require('puppeteer-extra-plugin-recaptcha')

puppeteer.use(

  RecaptchaPlugin({

    provider: {

      id: '2captcha',

      token: 'XXXXXXX' // REPLACE THIS WITH YOUR OWN 2CAPTCHA API KEY ⚡

    },

    visualFeedback: true // colorize reCAPTCHAs (violet = detected, green = solved)

  })

)



// puppeteer usage as normal

puppeteer.launch({ headless: true }).then(async browser => {

  const page = await browser.newPage()

  await page.goto('https://www.google.com/recaptcha/api2/demo')



  // That's it, a single line of code to solve reCAPTCHAs 🎉

  await page.solveRecaptchas()



  await Promise.all([

    page.waitForNavigation(),

    page.click(`#recaptcha-demo-submit`)

  ])

  await page.screenshot({ path: 'response.png', fullPage: true })

  await browser.close()

})

Code:
// `puppeteer-extra` and the recaptcha plugin are written in TS,
// hence you get perfect type support out of the box :)

import puppeteer from 'puppeteer-extra'
import RecaptchaPlugin from 'puppeteer-extra-plugin-recaptcha'

puppeteer.use(
  RecaptchaPlugin({
    provider: {
      id: '2captcha',
      token: 'ENTER_YOUR_2CAPTCHA_API_KEY_HERE'
    }
  })
)

// Puppeteer usage as normal (headless is "false" just for this demo)
puppeteer.launch({ headless: false }).then(async browser => {
  const page = await browser.newPage()
  await page.goto('https://www.google.com/recaptcha/api2/demo')

  // Even this `Puppeteer.Page` extension is recognized and fully type safe 🎉
  await page.solveRecaptchas()

  await Promise.all([
    page.waitForNavigation(),
    page.click(`#recaptcha-demo-submit`)
  ])
  await page.screenshot({ path: 'response.png', fullPage: true })
  await browser.close()
})

Documentation https://npm.io/package/puppeteer-extra-plugin-recaptcha