Skip to content

This repository provides minimal working examples for bypassing Cloudflare 1020 errors using Playwright in both Python and Node.js. The focus is on showing basic setups to load pages that are often protected by anti-bot measures, with step-by-step improvements like stealth plugins, proxy rotation, and human-like behaviors.

Notifications You must be signed in to change notification settings

HasData/cloudflare-bypass

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Python Node.js

Cloudflare 1020 Bypass Examples (Python & Node.js)

HasData_bannner

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.

Table of Contents

  1. Requirements
  2. Project Structure
  3. Bypass Examples

Requirements

Python 3.10+ or Node.js 18+

Python Setup

Required packages:

  • requests
  • playwright
  • playwright-stealth

Install:

pip install playwright
playwright install
pip install playwright-stealth

Node.js Setup

Required packages:

  • playwright
  • playwright-extra
  • playwright-extra-plugin-stealth

Install:

npm install playwright playwright-extra playwright-extra-plugin-stealth

Project Structure

cf1020-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.

Bypass Examples

Playwright Basic

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'

Playwright + Stealth

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

Residential Proxy Rotation

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)

User-Agent + Header Spoofing

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:[email protected]:8080'
timeout Max time to wait for page load (seconds) 30

Human-like Behavior

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)

Full Flow Example

All combined: stealth, headers, proxies, behavior — in one script.

Parameter Description Example
proxy Proxy server URL with auth 'http://user:[email protected]: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

Disclaimer

These examples are for educational purposes only. Learn more about the legality of web scraping.

📎 More Resources

About

This repository provides minimal working examples for bypassing Cloudflare 1020 errors using Playwright in both Python and Node.js. The focus is on showing basic setups to load pages that are often protected by anti-bot measures, with step-by-step improvements like stealth plugins, proxy rotation, and human-like behaviors.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published