Socket
Socket
Sign inDemoInstall

puppeteer-extra-plugin-capsolver

Package Overview
Dependencies
165
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    puppeteer-extra-plugin-capsolver

A puppeteer-extra plugin to interact/solve captcha with API.


Version published
Weekly downloads
117
decreased by-27.78%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

puppeteer-extra-plugin-capsolver

  • Manage to solve captcha challenges with AI (captcha service based).
  • Puppeteer browser context.
  • ❗ An API key it's required. Get here.

⬇️ Install

npm i puppeteer puppeteer-extra puppeteer-extra-plugin-capsolver

✋ Usage

Import and use within puppeteer-extra.

const puppeteer = require('puppeteer-extra')
const CapSolverPlugin = require('puppeteer-extra-plugin-capsolver')({
    apiKey: 'CAI-XXX ...',
    verboseLevel: 1,
    retry: true         // hcaptchaclicker: by default will retry challenges 
})
puppeteer.use(CapSolverPlugin)

🖱 HCaptcha (DOM feature)

  • await page.hcaptchaclicker(checkboxFrame=undefined) - handle a page including hcaptcha checkbox iframe example script (how to use).

  • Will detect for failed callenges (and retry) and for double challenges that sometimes appears.

  • Catch .hcaptchaclicker() exceptions for unsupported challenges.

  • Read more about recognize captcha images through HCaptcha Image Classification.

// get custom hcatpcha checkbox iframe
const desiredCheckboxFrame = await page.$("iframe[src*='custom-link-for-iframe-selector']")

await page.hcaptchaclicker(desiredCheckboxFrame) // pass no frame for detect the first on the page
.then(async (page) => {
    // submit if passed the challenge
    await page.click('#submit-my-form')
    await page.waitForNavigation()
}).catch((e) => {
    // ! catch clicker exception
    console.log(e)
})

📖 Handler / Solving Tasks API Wrapper

  • Based on capsolver-npm (nodejs api wrapper for capsolver.com api).

  • Handler it's attached to any puppeteer page.

  • Use the handler with:

await page.capsolver()

example: retrieve handler and call for funcaptcha token.

await page.capsolver()
    .funcaptchaproxyless(websiteURL, websitePublicKey, funcaptchaApiJSSubdomain) // see required parametes by https://github.com/0qwertyy/capsolver-npm#-supported-captcha-tasks
    .then((results) => {
        if (results.error !== 0) {
            // createTask solution
            const token = results.solution
        } else {
            console.log(`got an error! ${JSON.stringify(results.apiResponse)}`)
        }
    }).catch(e => {
        console.log(e)
    })
  • Note that await page.capsolver().runAynTask() it's also supported in the case of tasks that are not supported by task-bind methods. see: examples/run-any-task-example.js

📁 Working Examples

figure out at examples directory

Keywords

FAQs

Last updated on 13 Apr 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc