manage to solve captcha challenges with puppeteer

Install
npm i puppeteer puppeteer-extra puppeteer-extra-plugin-capsolver
Usage
- Import
puppeteer-extra
and the plugin package
const puppeteer = require("puppeteer-extra");
const {
SolverPlugin,
SolverPluginError,
SolverError,
} = require("puppeteer-extra-plugin-capsolver");
Auto-load official Browser Extension
-
How it works? This feature would auto-load the extension from a zipped file into static temp folder on your disk, then would load from there on demand refreshing apiKey
on load.
-
How to use with from the plugin?
- Set
useExtension
on plugin init. - Control the extension with
await page.waitForSolverCallback({ timeout })
.
puppeteer.use(
new SolverPlugin({
apiKey: process.env.APIKEY,
useExtension: true,
useExtensionProxy: process.env.PROXYSTRING,
useExtensionReCaptchaMode: "token",
})
);
await page.waitForSolverCallback({
});
Common usage: call the API
puppeteer.use(
new SolverPlugin({
apiKey: process.env.APIKEY,
})
);
await page
.solver()
.recaptchav2classification({
})
.then((s: any) => {
console.log(s);
})
.catch((e: SolverError) => {
console.log(`Errored task Id: ${e.errorTaskId}`);
console.log(`Error Code: ${e.errorCode}`);
console.log(`Error description: ${e.errorDescription}`);
});
📁 Updated examples
Figure out here.
Disclaimer
By using this package, you acknowledge and agree that:
- You are solely responsible for how you use the API and the author does not assume any liability for misuse, abuse, or violations of Capsolver’s terms of service.
- This package provides a service connector for the Capsolver API and is not affiliated.