Puppeteer (Node.js) Module
Uses Puppeteer to automatically solve CAPTCHAs. Supports image clicking, slider dragging, and other CAPTCHA types.
Latest Version
| Module Version | Download | Changes |
|---|---|---|
| 0.1 | 0.1 | Initial release |
Installation
bash
npm install puppeteerCopy the capguru folder into your project.
Usage
Import CaptchaSolver from the package. Pass the page containing the CAPTCHA along with your API key. Call the appropriate CAPTCHA-solving method. Allow a few seconds for the CAPTCHA interaction to complete.
javascript
const puppeteer = require('puppeteer');
const { CaptchaSolver } = require('./capguru');
(async () => {
const browser = await puppeteer.launch({ headless: false });
const page = await browser.newPage();
await page.goto('https://example.com/with-captcha');
const solver = new CaptchaSolver({
page,
apiKey: 'YOUR_CAPGURU_API_KEY',
debug: true,
attempts: 5,
});
await solver.solveRecaptcha2();
await browser.close();
})();Call the Appropriate Method
await solver.solveRecaptcha2();
// await solver.solveHcaptcha();
// await solver.solveOther();
// await solver.solveGeetest();
// await solver.solveFuncaptcha();
// await solver.solveTiktok();Supported CAPTCHA Types
| reCaptcha2 | FunCaptcha | TikTok | GeeTest | hCaptcha | Other |
|---|---|---|---|---|---|
| Yes | Yes | Yes | Yes | Yes | Yes |
Constructor Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
page | Page | � | Puppeteer page instance |
apiKey | string | � | Cap.Guru API key |
server | string | 'https://api.cap.guru' | API server URL |
attempts | number | 5 | Max number of solving attempts |
debug | boolean | false | Enable debug logging |
selector | string | '' | CSS selector for the CAPTCHA container |
Requirements
- Node.js ? 18
- Puppeteer ? 23
Error Handling
All solvers throw an Error on failure:
javascript
try {
await solver.solveRecaptcha2();
} catch (e) {
if (e.message.includes('ERROR_CAPTCHA_UNSOLVABLE')) {
console.log('CAPTCHA could not be solved after all attempts');
}
}