- 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
})
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.
const desiredCheckboxFrame = await page.$("iframe[src*='custom-link-for-iframe-selector']")
await page.hcaptchaclicker(desiredCheckboxFrame)
.then(async (page) => {
await page.click('#submit-my-form')
await page.waitForNavigation()
}).catch((e) => {
console.log(e)
})
📖 Handler / Solving Tasks API Wrapper
await page.capsolver()
example: retrieve handler and call for funcaptcha token.
await page.capsolver()
.funcaptchaproxyless(websiteURL, websitePublicKey, funcaptchaApiJSSubdomain)
.then((results) => {
if (results.error !== 0) {
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