A puppeteer-extra plugin to interact/solve with API.
npm install @popouille/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
-
1. Import and use within puppeteer-extra.
``javascript `
const puppeteer = require('puppeteer-extra');
const CapSolverPlugin = require('puppeteer-extra-plugin-capsolver')();
puppeteer.use(CapSolverPlugin);
2. .setHandler('apikey', verbose) - at the top of your script.
Set your apikey in order to request solving tasks.
`javascript `
CapSolverPlugin.setHandler('CAI-XXX...', 1); // debug tasks: 1 or 2
š Handler / Solving API Wrapper
-
- Handler it's based on capsolver-npm (nodejs api wrapper for capsolver.com api).
- Retrieve the currently handler:
`javascript`
const handler = CapSolverPlugin.handler()
- Perform any method that capsolver-npm brings.
- Supported captcha tasks listed on capsolver-npm at Supported API methods.
example: retrieve handler and call for funcaptcha token.
`javascript`
//
await CapSolverPlugin.handler()
.funcaptchaproxyless(websiteURL, websitePublicKey, funcaptchaApiJSSubdomain)
.then((response) => {
if(response.error !== 0){
const token = response.apiResponse.solution;
}else{
const token = null;
console.log('[myapp][got error]' + JSON.stringify(response.apiResponse))
}
}).catch(e => {
console.log(e);
})
š± Extra DOM Features
-
- [x] await CapSolverPlugin.hcaptchaclicker(page) - handle a page including hcaptcha iframe and trigger it, then emulates human clicks. example script (how to use).
`javascript
puppeteer.launch({ headless: false })
.then(async browser => {
let page = await browser.newPage();
await page.goto(targeturl);
await CapSolverPlugin.hcaptchaclicker(page, true)
.then(async (page) => {
// handle clicker success
await page.click('#submit');
await page.waitForNavigation();
}).catch((e) => {
// handle clicker error
console.log(e);
});
})
``

- [ ] hcaptcha callback.
- [ ] funcaptcha clicker.
- [ ] funcaptcha callback.
š Examples
-
figure out at examples directory