Scrapling Beats BeautifulSoup 784x While Bypassing Cloudflare Automatically
An open-source Python framework combines a self-healing parser, anti-bot fetchers, and a Scrapy-like spider engine into a single library.
ProTakeaways
- Scrapling is an adaptive Python web scraping framework with 69k+ GitHub stars.
- Adaptive parser relocates elements automatically when target websites change their HTML structure.
- StealthyFetcher bypasses Cloudflare Turnstile and Interstitial anti-bot challenges out of the box.
- Scrapy-like spider framework adds pause/resume checkpoints, streaming mode, and AutoThrottle per domain.
- Built-in MCP server pre-filters HTML for Claude, Cursor, and other AI agents to cut token costs.
- Parser matches lxml speed at 2.02ms per 5,000 elements, roughly 784x faster than BeautifulSoup with lxml.
Web scraping has always been a game of whack-a-mole. You write selectors, the site changes its class names, your pipeline breaks. You add a headless browser, Cloudflare fingerprints it. You stitch together requests, Playwright, and a proxy pool, and now you're maintaining three libraries instead of shipping data. Scrapling is a Python framework that tries to collapse that stack into one package, with an adaptive parser that relearns selectors when pages change and fetchers that ship with anti-bot bypass built in.
The project has crossed 69,000 GitHub stars and is released under BSD-3. It describes itself as an adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl, positioning itself somewhere between BeautifulSoup, Scrapy, and Playwright rather than replacing any single one of them.
The self-healing selector problem
The headline feature is what the project calls adaptive parsing. Its parser learns from website changes and automatically relocates your elements when pages update. In practice you scrape an element once with auto_save=True, and later, if the HTML structure has shifted, you pass adaptive=True and Scrapling uses similarity algorithms to find the closest match to what you originally captured.
from scrapling.fetchers import StealthyFetcher
StealthyFetcher.adaptive = True
p = StealthyFetcher.fetch('https://example.com', headless=True, network_idle=True)
products = p.css('.product', auto_save=True) # first run: remember this element
products = p.css('.product', adaptive=True) # later: relocate it if the DOM changedThat single behavior addresses the most common reason scrapers rot in production. Instead of babysitting selectors after every A/B test on the target site, the parser keeps a fingerprint of the element and hunts it down when the CSS path no longer resolves.
Three fetchers, one anti-bot story
Scrapling splits network access into three classes with the same API surface. The Fetcher class does fast HTTP requests that can impersonate browsers' TLS fingerprint, headers, and use HTTP/3. DynamicFetcher handles dynamic websites through Playwright's Chromium and Google's Chrome. StealthyFetcher adds fingerprint spoofing and can bypass all types of Cloudflare's Turnstile and Interstitial with automation.
Session objects (FetcherSession, StealthySession, DynamicSession) persist cookies and state, and every fetcher can pull from a built-in ProxyRotator. There is also optional DNS-over-HTTPS support to route DNS queries through Cloudflare's DoH, preventing DNS leaks when using proxies, plus a domain and ad-blocking list of roughly 3,500 known trackers for browser-based sessions.
Scaling up to a full spider framework
Where BeautifulSoup stops, Scrapling keeps going. The spider API is Scrapy-like, defining spiders with start_urls, async parse callbacks, and Request/Response objects, but with a few conveniences that Scrapy users have wanted for years:
- Checkpoint-based crawl persistence. Press Ctrl+C for a graceful shutdown; restart to resume from where you left off.
- Streaming mode via async for item in spider.stream() with real-time stats, useful for UI, pipelines, and long-running crawls.
- AutoThrottle that tunes per-domain delay from response times, then doubles it or waits what Retry-After asks when the site starts blocking, and speeds back up once it stops.
- Multi-session support that routes requests to different sessions by ID in a single spider, so you can send simple pages through fast HTTP and only escalate to a stealth browser when a page is actually protected.
- Ready-made templates including
CrawlSpider,SitemapSpider,XMLFeedSpider,CSVFeedSpider, and aShopifySpiderthat pulls every product variant from any Shopify store through its JSON API.
An MCP server for AI agents
The AI angle is not a bolted-on chatbot. Scrapling ships a built-in MCP server that leverages the library to extract targeted content before passing it to the AI (Claude/Cursor/etc), speeding up operations and reducing costs by minimizing token usage. Instead of dumping raw HTML into a model's context, the server pre-filters with CSS/XPath and returns only the relevant fragments.
There's also an Agent Skill in the repo. It's a ready-to-install skill that teaches coding agents the whole library, so the code they write with Scrapling matches the current API instead of guessing, which is a nice acknowledgement that LLMs hallucinate scraping APIs constantly.
Performance that actually competes with lxml
Speed is often the deciding factor between BeautifulSoup and everything else. Scrapling publishes benchmarks for text extraction on 5,000 nested elements:
| Library | Time (ms) | vs Scrapling |
|---|---|---|
| Scrapling | 2.02 | 1.0x |
| Parsel/Scrapy | 2.04 | 1.01x |
| Raw lxml | 2.54 | 1.26x |
| PyQuery | 24.17 | ~12x |
| Selectolax | 82.63 | ~41x |
| BS4 with lxml | 1584.31 | ~784x |
| BS4 with html5lib | 3391.91 | ~1679x |
The parser sits essentially at Parsel/lxml speed while adding features neither of them has. On the adaptive side, its element similarity search runs in 2.39 ms compared to 12.45 ms for AutoScraper, roughly a 5x speedup.
Getting it running
Installation is a two-step because the browser dependencies are heavy. The base parser is Python 3.10+:
pip install scrapling # parser only
pip install "scrapling[fetchers]" # add HTTP + browser fetchers
scrapling install # download browsers and fingerprint deps
pip install "scrapling[all]" # everything, including MCP and shellThere's also a documentation site, a Docker image with all browsers preinstalled at pyd4vinci/scrapling, and a CLI that can extract a page to Markdown, plain text, or filtered HTML without writing any Python at all:
scrapling extract get 'https://example.com' content.md
scrapling extract stealthy-fetch 'https://nopecha.com/demo/cloudflare' out.html --solve-cloudflareWhere it fits and where it doesn't
Scrapling is a strong fit if you're doing production scraping that has to survive site redesigns, or if you're building AI agents that need to hit protected websites without burning tokens on raw HTML. The multi-session spider with pause/resume is especially useful for long crawls where a mid-run crash currently means starting over.
The honest limitations: the browser-heavy features inherit Playwright's memory footprint, so tiny serverless environments will struggle. Anti-bot bypass is a moving target, and while Cloudflare Turnstile works out of the box, harder systems like Akamai, DataDome, and Kasada still require third-party token APIs. And if you already have a mature Scrapy codebase, the migration path is real work, though the library does offer a scrapling_response decorator to plug its parser into existing Scrapy callbacks without a rewrite.
For most teams looking at scraping in 2026, the interesting shift here is architectural. Instead of gluing requests plus beautifulsoup4 plus playwright plus scrapy plus a bespoke proxy layer, one BSD-licensed library covers the full pipeline with an API that reads like Parsel and behaves like a modern crawler.