This repo contains working examples of bypassing Cloudflare 1020 errors using Playwright + Stealth with residential proxies, rotating headers, and basic anti-bot evasion tricks. Works in Node.js and Python.
Python 3.10+ or Node.js 18+
Required packages:
requestsplaywrightplaywright-stealth
Install:
pip install playwright playwright install pip install playwright-stealthRequired packages:
playwrightplaywright-extraplaywright-extra-plugin-stealth
Install:
npm install playwright playwright-extra playwright-extra-plugin-stealthcf1020-bypass-examples/ │ ├── python/ │ ├── basic_playwright.py │ ├── stealth_playwright.py │ ├── proxy_rotation.py │ ├── header_rotation.py │ ├── human_behavior.py │ ├── full_flow_example.py │ ├── nodejs/ │ ├── basic_playwright.js │ ├── stealth_playwright.js │ ├── proxy_rotation.js │ ├── header_rotation.js │ ├── human_behavior.js │ ├── full_flow_example.js │ └── README.md Each script shows a different tactic for avoiding Cloudflare 1020. No frameworks, no noise — just straight working examples.
Basic page load using vanilla Playwright (likely to trigger CAPTCHA or 1020).
| Parameter | Description | Example |
|---|---|---|
url | Target URL to load | 'https://example.com' |
timeout | Maximum wait time (ms) | 60000 |
output_file | File to save page HTML | 'page.html' |
Hide webdriver flag, spoof plugins, patch headless indicators.
| Parameter | Description | Example |
|---|---|---|
target_url | URL to visit and scrape | 'https://example.com' |
headless | Run browser in headless mode | True |
timeout | Maximum wait time (ms) | 60000 |
Add a pool of rotating residential proxies for better IP reputation.
| Parameter | Description | Example |
|---|---|---|
target_url | URL to visit with rotating headers | 'https://example.com' |
user_agents | List of User-Agent strings to rotate | ['Mozilla/5.0...', 'Chrome/91.0...'] |
extra_headers | Additional HTTP headers to include (optional) | {'Accept-Language': 'en-US,en;q=0.9'} |
rotate_every | Number of requests before changing header | 1 (rotate every request) |
Randomized headers and modern user agents for each session.
| Parameter | Description | Example |
|---|---|---|
target_url | URL to visit with rotated headers | 'https://example.com' |
user_agents | List of User-Agent strings to rotate | ["Mozilla/5.0...", "Safari/537.36"] |
headers | Additional HTTP headers to include | {"Accept-Language": "en-US,en;q=0.9"} |
proxy | Proxy server address (optional) | 'http://user:pass@proxy.com:8080' |
timeout | Max time to wait for page load (seconds) | 30 |
Add mouse movement, scrolling, and timed delays.
| Parameter | Description | Example |
|---|---|---|
page | Playwright page object | page.goto('https://example.com') |
sleep | Pause execution for realism | time.sleep(1.5) / await sleep(1500) (ms) |
mouse.move(x, y) | Move mouse cursor to (x, y) | page.mouse.move(100, 100) |
mouse.click(x, y) | Click at coordinates (x, y) | page.mouse.click(200, 300) |
keyboard.press(key) | Simulate keyboard key press | page.keyboard.press('PageDown') |
mouse.wheel(deltaX, deltaY) | Scroll page by delta | page.mouse.wheel(0, 400) |
All combined: stealth, headers, proxies, behavior — in one script.
| Parameter | Description | Example |
|---|---|---|
proxy | Proxy server URL with auth | 'http://user:pass@proxy.example:8000' |
user_agent | Browser user agent string | 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)...' |
target_url | URL to navigate and scrape | 'https://example.com' |
headless | Whether to run browser in headless mode | True (Python) / true (Node.js) |
delay_range | Range (seconds) for random delays between actions | 0.5 to 2 seconds |
These examples are for educational purposes only. Learn more about the legality of web scraping.
