← Back to list

784x Faster Scraping then BeautifulSoup:Open Source tool

One library. Zero compromises. From a single HTTP request to a full-scale concurrent crawl.

Sahil Kumar · 2026-05-04 17:53 · 1 claps · 4.4 min read
#scraping #open-source #free #beautifulsoup #website
Open on Medium ↗
Wiki topics: 🔓 · Open Source 📚 · Books & Reading

784x Faster Scraping then BeautifulSoup:Open Source tool

One library. Zero compromises. From a single HTTP request to a full-scale concurrent crawl.

Web scraping in 2025 is a constant arms race. Websites deploy Cloudflare Turnstile, TLS fingerprinting, and bot-detection middleware. Scrapers break the moment a site redesigns its layout. Maintaining a scraper fleet is a full-time job.

Its parser learns from website changes and automatically relocates your elements when pages update. Its fetchers bypass anti-bot systems like Cloudflare Turnstile out of the box. And its spider framework lets you scale up to concurrent, multi-session crawls with pause/resume and automatic proxy rotation — all in a few lines of Python. One library, zero compromises.

Scrapling organizes its functionality into three primary subsystems accessed through four user entry points. The framework uses lazy imports to minimize memory footprint and load time.

Scrapling Entry Points and Subsystems

Scrapling Entry Points and Subsystems

Key Components and Their Roles

Key Features

Spiders — A Full Crawling Framework

  • 🕷️ Scrapy-like Spider API: Define spiders with start_urls, async parse callbacks, and Request/Response objects.
  • ⚡ Concurrent Crawling: Configurable concurrency limits, per-domain throttling, and download delays.
  • 🔄 Multi-Session Support: Unified interface for HTTP requests, and stealthy headless browsers in a single spider — route requests to different sessions by ID.
  • 💾 Pause & Resume: Checkpoint-based crawl persistence. Press Ctrl+C for a graceful shutdown; restart to resume from where you left off.
  • 📡 Streaming Mode: Stream scraped items as they arrive via async for item in spider.stream() with real-time stats - ideal for UI, pipelines, and long-running crawls.
  • 🛡️ Blocked Request Detection: Automatic detection and retry of blocked requests with customizable logic.
  • 🤖 Robots.txt Compliance: Optional robots_txt_obey flag that respects Disallow, Crawl-delay, and Request-rate directives with per-domain caching.
  • 🧪 Development Mode: Cache responses to disk on the first run and replay them on subsequent runs — iterate on your parse() logic without re-hitting the target servers.
  • 📦 Built-in Export: Export results through hooks and your own pipeline or the built-in JSON/JSONL with result.items.to_json() / result.items.to_jsonl() respectively.

Installation and Dependency Structure

Scrapling uses a modular installation approach with optional dependency groups defined in pyproject.toml. This allows users to install only what they need, keeping the core package lightweight.

Dependencies

Dependencies

For HTML/XML parsing without network fetching capabilities:

pip install scrapling

This installs the parsing engine and core utilities:

  • lxml>=6.0.2: High-performance XML and HTML parsing.
  • cssselect>=1.4.0: Translates CSS selectors to XPath.
  • orjson>=3.11.8: Fast JSON parsing for TextHandler.json() and AttributesHandler.json().
  • tld>=0.13.2: URL parsing and top-level domain extraction.

To use fetcher classes (Fetcher, DynamicFetcher, StealthyFetcher) or the CLI:

pip install "scrapling[fetchers]"
scrapling install

The scrapling install command is mandatory for browser-based fetchers as it downloads binaries not included in the PyPI package.

Verification

To verify the installation, you can test the core parser and the static fetcher:

from scrapling import Selector, Fetcher

# Verify Parser
sel = Selector("<h1>Scrapling</h1>")
print(sel.css("h1::text").get()) # Output: Scrapling

# Verify Fetcher (requires [fetchers] extra)
response = Fetcher.get("https://httpbin.org/status/200")
print(response.status) # Output: 200

Quick Start Guide

1.Parsing HTML Without Fetching

from scrapling.parser import Selector

html = """
<div class="product">
    <h3>Product Name</h3>
    <span class="price">$29.99</span>
</div>
"""

page = Selector(html)
title = page.css('.product h3::text').get()
price = page.css('.price::text').get()
print(f"{title}: {price}")  # Output: Product Name: $29.99
  1. Making HTTP Requests
from scrapling.fetchers import Fetcher

response = Fetcher.get('https://quotes.toscrape.com/')
quotes = response.css('.quote .text::text').getall()
authors = response.css('.quote .author::text').getall()

for quote, author in zip(quotes, authors):
    print(f'"{quote}" - {author}')

3.Browser Automation

from scrapling.fetchers import DynamicFetcher

page = DynamicFetcher.fetch('https://quotes.toscrape.com/', headless=True)
quotes = page.css('.quote .text::text').getall()

4.Stealth Mode with Anti-Bot Bypass

from scrapling.fetchers import StealthyFetcher

page = StealthyFetcher.fetch(
    'https://example.com',
    headless=True,
    network_idle=True
)
# Bypasses Cloudflare Turnstile out of the box
content = page.css('.content').get()

5.Session Management for Multiple Requests

from scrapling.fetchers import FetcherSession

with FetcherSession(impersonate='chrome') as session:
    page1 = session.get('https://quotes.toscrape.com/')
    page2 = session.get('https://quotes.toscrape.com/page/2/')

6.Browser Session with Tab Pooling

from scrapling.fetchers import AsyncStealthySession
import asyncio

async def scrape():
    # max_pages controls the tab pool size
    async with AsyncStealthySession(max_pages=3, headless=True) as session:
        tasks = [
            session.fetch('https://example.com/page1'),
            session.fetch('https://example.com/page2'),
            session.fetch('https://example.com/page3'),
        ]
        results = await asyncio.gather(*tasks)
        return results

asyncio.run(scrape())

7.Running Your First Spider

from scrapling.spiders import Spider, Response

class QuotesSpider(Spider):
    name = "quotes"
    start_urls = ["https://quotes.toscrape.com/"]

    async def parse(self, response: Response):
        # Extract quotes from current page
        for quote in response.css('.quote'):
            yield {
                "text": quote.css('.text::text').get(),
                "author": quote.css('.author::text').get(),
            }

        # Follow pagination
        next_page = response.css('.next a::attr(href)').get()
        if next_page:
            yield response.follow(next_page)

# Run the spider
result = QuotesSpider().start()
print(f"Scraped {len(result.items)} quotes")
result.items.to_json("quotes.json")

8.Adaptive Parsing for Website Changes

from scrapling.fetchers import StealthyFetcher

# Enable adaptive mode
StealthyFetcher.adaptive = True

# First run: save element signatures
page = StealthyFetcher.fetch('https://example.com')
products = page.css('.product', auto_save=True)

# Later, after website structure changes:
page = StealthyFetcher.fetch('https://example.com')
# Scrapling will find the elements even if the .product class is gone
products = page.css('.product', adaptive=True)

9.AI Integration — MCP Server

#Scrapling includes a built-in MCP (Model Context Protocol) server that lets 
#AI assistants like Claude or Cursor use Scrapling as a web scraping tool. 
#It extracts targeted content before passing it to the AI, reducing token 
#usage and cost.
scrapling mcp

Command Line Interface

Scrapling provides CLI commands for quick data extraction and interactive debugging.

# Extract to markdown
scrapling extract get 'https://example.com' content.md

# Extract specific CSS selector to text with TLS impersonation
scrapling extract get 'https://example.com' output.txt \
    --css-selector '.content' --impersonate 'chrome'

# Stealth mode with Cloudflare bypass
scrapling extract stealthy-fetch 'https://example.com' \
    output.html --solve-cloudflare

Summary

Scrapling is a well-engineered, production-ready library that covers the full spectrum of modern web scraping needs. Its progressive fetcher hierarchy means you only pay the performance cost of what you actually need. Its adaptive parser is a genuine differentiator — scrapers that self-heal after site redesigns are rare. And the spider framework brings Scrapy-level power without Scrapy’s complexity.

Follow me for more tech blogs and useful products available on Gumroad.

Linkedln — https://www.linkedin.com/in/sahilk2001/

Gumroad — https://sahilv05.gumroad.com/l/degajn


메타데이터
post_id
45f4fc231bac
slug
784x-faster-scraping-then-beautifulsoup-open-source-tool-45f4fc231bac
url
https://medium.com/@miniallin271023/784x-faster-scraping-then-beautifulsoup-open-source-tool-45f4fc231bac
canonical_url
https://medium.com/@miniallin271023/784x-faster-scraping-then-beautifulsoup-open-source-tool-45f4fc231bac
author_url
https://medium.com/@miniallin271023
status
ok
fetched_at
2026-06-09 15:37:30