Advanced CAPTCHA solving automation with multi-provider fallback support for Playwright/Puppeteer.
- Features
- Installation
- Usage
- Configuration
- Supported CAPTCHAs
- Provider Capabilities
- Strategy
- Requirements
- License
- 🛡 Multi-Provider Fallback: Configure primary and backup solvers
- 🤖 Smart Detection: Auto-recognizes 15+ CAPTCHA types
- 🔄 Priority Routing: Tries providers in configured order
- 🎯 Type-Specific Resolution: Selects optimal solver per CAPTCHA type
- 📊 Visual Feedback: Interactive loading indicators
- 🚀 Playwright/Puppeteer Ready: Works with modern browser automation
npm install auto-captcha-solver
import { captchaSolver } from 'auto-captcha-solver';
import { chromium } from 'playwright';
async function solveCaptcha() {
const browser = await chromium.launch();
const page = await browser.newPage();
await page.goto('https://site-with-captcha.com');
const result = await captchaSolver(page, {
providers: [
{ name: 'capmonster', apiKey: 'CAPMONSTER_KEY' }, // Primary
{ name: '2captcha', apiKey: '2CAPTCHA_KEY' } // Fallback
],
// optional: required for 'Image To Text' captcha type
imageSelector: '#captcha-img',
inputSelector: '#captcha-input'
});
if (result.success) {
await page.click('#submit-form');
}
await browser.close();
}
// Traditional single provider configuration
const result = await captchaSolver(page, {
providers: [{ name: '2captcha', apiKey: 'YOUR_KEY' }]
// Additional options...
});
interface CaptchaConfig {
// Required provider configuration
providers: Array<{
name: 'capmonster' | '2captcha';
apiKey: string;
}>;
// Image CAPTCHA options
captchaType: 'Image To Text';
imageSelector?: string; // '#captcha-img',
inputSelector?: string; // '#captcha-input'
numericCount?: number; // 2
minLength?: number; // 5
maxLength?: number; // 5
// Text CAPTCHA options
captchaType: 'Text Captcha';
textSelector?: string; // '.text-question'
inputSelector?: string; // '#captcha-input'
textLanguage?: string; // 'en'
// Advanced options
module?: CapMonsterModules;
caseSensitive?: boolean;
threshold?: number;
math?: boolean; // 1 or 0
}
CAPTCHA Type | Example Sites |
---|---|
reCAPTCHA v2 | Google services |
reCAPTCHA v3 | Registration forms |
hCaptcha | Cloudflare-protected sites |
Image CAPTCHA | Legacy systems |
Cloudflare Turnstile | Secure portals |
GeeTest v4 | Financial platforms |
Text CAPTCHA | Comment sections |
MTCaptcha | News websites |
CAPTCHA Type | CapMonster | 2Captcha |
---|---|---|
Image To Text | ✓ | ✓ |
reCAPTCHA v2 | ✓ | ✓ |
reCAPTCHA v2 Invisible | ✓ | |
reCAPTCHA v3 | ✓ | ✓ |
hCaptcha | ✓ | |
Cloudflare Turnstile | ✓ | ✓ |
GeeTest v4 | ✓ | |
Text CAPTCHA | ✓ | |
MTCaptcha | ✓ |
- Detection: Automatically identifies CAPTCHA type
- Filtering: Selects providers supporting detected type
-
Execution:
- Tries providers in configured order
- Uses first successful solution
- Collects error information for diagnostics
-
Fallback: Automatically switches providers if:
- Current provider doesn't support CAPTCHA type
- API request fails
- Solution injection fails
- Node.js 16+
- Playwright/Puppeteer
- Valid API keys for selected providers
- TypeScript (recommended)
ISC © Seven Builder
Report issues at GitHub Repository
Pro Tip: For best results, configure multiple providers to maximize CAPTCHA type coverage and ensure higher success rates! 🚀
This README emphasizes the new multi-provider functionality while maintaining all existing documentation. Key improvements:
1. Clear multi-provider configuration examples
2. Provider capability matrix for quick reference
3. Detailed resolution strategy explanation
4. Backward compatibility with single-provider setup
5. Improved visual hierarchy and organization
6. Practical examples for different use cases
7. Clear requirements and support information
The document maintains technical accuracy while being approachable for developers of different experience levels.