█

AI/TLDR

Buy me a coffee
Buy me a coffee

Crawlee for Python

A Python web scraping and browser automation library for building reliable crawlers

Web Scraping & CrawlingOpen source
Language
Python
IN SHORT

What is Crawlee for Python?

Crawlee for Python is the Python version of the Crawlee library from Apify. It sits in the Web Scraping & Crawling category of the Data & Labeling tools and is open-source, written in Python. To get started: install Crawlee.

Overview

Crawlee for Python is the Python version of the Crawlee library from Apify. It handles crawling and scraping end-to-end: following links, extracting data, and storing it in machine-readable formats, so you can focus on what data you want instead of the plumbing around it.

It is aimed at Python developers who need to collect web data at scale, including data for AI, LLMs, and RAG pipelines. It offers both an HTTP-based crawler that parses HTML with BeautifulSoup and a Playwright-based crawler for sites that need client-side JavaScript, with default settings tuned so crawlers blend in and avoid common bot protections.

Within the web scraping and crawling space, Crawlee sits as a full framework rather than a single-purpose tool. It manages the request queue, link enqueuing, retries, and persistent storage for you, and exposes rich configuration when the defaults are not enough. A TypeScript implementation is also available for JavaScript projects.

What it does

  • Two crawler types: BeautifulSoupCrawler for fast HTTP-based HTML scraping, and PlaywrightCrawler for JavaScript-heavy sites
  • Default configuration makes crawlers appear human-like to reduce blocking by modern bot protections
  • Built-in link enqueuing with context.enqueue_links() to crawl a site by following discovered links
  • Persistent storage via context.push_data() that writes scraped data to a local storage/ directory
  • Crawlee CLI with ready-made project templates to scaffold a new crawler quickly
  • Modular install: a small core package plus optional extras like beautifulsoup and all to keep dependencies minimal

Getting started

Crawlee is published on PyPI as the crawlee package. Install it, set up Playwright, then run a minimal crawler.

Install Crawlee

Install the package with all features, then install the Playwright browser dependencies.

bashbash
python -m pip install 'crawlee[all]'
playwright install

Verify the installation

Confirm Crawlee is importable and print its version.

bashbash
python -c 'import crawlee; print(crawlee.__version__)'

Scaffold a project with the CLI (optional)

The quickest start is the Crawlee CLI, which offers prepared templates. It requires uv.

bashbash
uvx 'crawlee[cli]' create my-crawler

Write a minimal crawler

This BeautifulSoupCrawler fetches pages over HTTP, extracts the title, stores the data, and follows links. A run creates a storage/ directory in your working directory.

pythonpython
import asyncio

from crawlee.crawlers import BeautifulSoupCrawler, BeautifulSoupCrawlingContext

async def main() -> None:
    crawler = BeautifulSoupCrawler(
        # Limit the crawl to max requests. Remove or increase it for crawling all links.
        max_requests_per_crawl=10,
    )

    # Define the default request handler, which will be called for every request.
    @crawler.router.default_handler
    async def request_handler(context: BeautifulSoupCrawlingContext) -> None:
        context.log.info(f'Processing {context.request.url} ...')

        # Extract data from the page.
        data = {
            'url': context.request.url,
            'title': context.soup.title.string if context.soup.title else None,
        }

        # Push the extracted data to the default dataset.
        await context.push_data(data)

        # Enqueue all links found on the page.
        await context.enqueue_links()

    # Run the crawler with the initial list of URLs.
    await crawler.run(['https://crawlee.dev'])

if __name__ == '__main__':
    asyncio.run(main())

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Collecting web data to feed AI, LLM, and RAG pipelines
  • Scraping structured data from static HTML pages at scale using the HTTP-based BeautifulSoupCrawler
  • Crawling JavaScript-heavy sites that need a real browser via the PlaywrightCrawler
  • Building a site crawler that follows links and persists results to local storage for later processing

How Crawlee for Python compares

Crawlee for Python alongside other open-source web scraping & crawling tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
Firecrawl★ 214kA crawling service and API that converts whole websites into clean Markdown or structured JSON ready for LLMs.
Agent Reach★ 116kA capability layer that installs, health-checks and routes readers so a CLI agent can read and search web pages, YouTube, RSS, GitHub, Reddit, Twitter/X and more without API fees.
Scrapling★ 107kA Python web scraping framework whose parser relocates your elements when pages change, with stealthy fetchers and a Scrapy-like spider engine for full crawls.
Crawl4AI★ 88.2kA local-first Python web crawler that turns pages into clean Markdown for use in RAG and LLM pipelines.
Scrapy★ 65.7kA mature Python framework for writing fast spiders that crawl websites and extract structured data at scale.
changedetection.io★ 36.1kA self-hosted web page change monitor with XPath/CSS/jq filters, browser steps and restock alerts, which can route every diff through an LLM to suppress noise.
ScrapeGraphAI★ 33kA Python library that uses LLMs and a graph pipeline to extract data from pages based on natural-language prompts.
Crawlee for Python★ 9.7kA Python web scraping and browser automation library for building reliable crawlers