Puppeteer Stealth Skill
A comprehensive web automation skill that implements ethical browser automation with anti-bot evasion capabilities using Puppeteer Extra and Stealth plugin.
Features
- Stealth Mode: Uses puppeteer-extra-plugin-stealth to avoid detection
- Randomized Configurations: User-agent rotation, viewport variation, and fingerprint randomization
- Cookie Management: Import/export cookies for session persistence
- CAPTCHA Detection: Screenshot capture and analysis for CAPTCHA identification
- Human-like Behavior: Realistic delays and interaction patterns
- Flexible Modes: Support for both headless and headful browser operations
- Error Handling: Robust handling of Cloudflare challenges and common anti-bot measures
- Ethical Compliance: Built-in rate limiting and respectful scraping practices
Usage
// Basic stealth scraping
const result = await skill.stealthScrape({
url: 'https://example.com',
selector: '.content',
options: { headless: true, captureScreenshots: true }
});
// Cookie management
await skill.saveCookies('session-cookies.json');
await skill.loadCookies('session-cookies.json');
// Human-like interaction
await skill.humanClick('.button');
await skill.humanType('#search', 'query', { delay: 100 });
API Reference
Methods
initialize(options)- Initialize stealth browser instancestealthScrape(config)- Perform stealthy web scrapinghumanClick(selector)- Simulate human-like clickhumanType(selector, text, options)- Simulate human-like typingsaveCookies(filepath)- Export cookies to fileloadCookies(filepath)- Import cookies from filecaptureScreenshot(path)- Take screenshot for analysisdetectCaptcha()- Detect if CAPTCHA is presenthandleCloudflare()- Attempt to bypass Cloudflare challengesclose()- Clean up browser resources
Installation
Install dependencies in your project:
npm install puppeteer puppeteer-extra puppeteer-extra-plugin-stealth puppeteer-extra-plugin-user-preferences user-agents
Ethical Guidelines
- Always respect robots.txt files
- Implement reasonable delays between requests
- Do not overload target servers
- Use only for legitimate purposes
- Comply with website terms of service
- Never use for malicious activities
Converted and distributed by TomeVault — claim your Tome and manage your conversions.