Python web scraping libraries

Updated Nov 2026

Python web scraping libraries download web pages and extract data from their HTML. Price trackers, search indexes, and AI agents that read the web use these libraries to turn pages into structured records or clean text.

Popularity

beautifulsoup4 has the most installs, while firecrawl has the most GitHub stars.

LibraryMonthly downloadsStarsLast releaseLicense
beautifulsoup4
289.6M
Not on GitHubJun 2026MIT
trafilatura
12.9M
7.1KOct 2026Apache-2.0
scrapy
4.3M
65.3KNov 2026BSD-3-Clause
parsel
3.2M
1.4KSep 2026BSD-3-Clause
crawl4ai
1.3M
87.1KOct 2026Apache-2.0
Scrapling
919.9K
99.8KNov 2026BSD-3-Clause
crawlee-python
818.7K
9.7KNov 2026Apache-2.0
firecrawl
702.0K
199.8KNov 2026AGPL-3.0
Downloads: PyPI, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

Features compared

LibraryRenders JavaScript pagesCrawls and follows linksSends async requestsSelects with XPathOutput formats
beautifulsoup4UnsupportedUnsupportedUnsupportedUnsupportedText
trafilaturaUnsupportedBuilt-inUndocumentedBuilt-inMarkdown, JSON
scrapyVia pluginVia pluginBuilt-inBuilt-inJSON, CSV, XML
parselUnsupportedUnsupportedUnsupportedBuilt-inText
crawl4aiBuilt-inBuilt-inBuilt-inBuilt-inMarkdown, JSON
ScraplingBuilt-inBuilt-inBuilt-inBuilt-inMarkdown, JSON
crawlee-pythonBuilt-inBuilt-inBuilt-inBuilt-inJSON, CSV
firecrawlBuilt-inBuilt-inBuilt-inUnsupportedMarkdown, JSON
Built-inVia pluginNot supportedNot documented

Libraries and code examples

beautifulsoup4

Beautiful Soup turns an HTML or XML document into a tree of Python objects that code can search and change. The library hands the raw parsing to a separate parser: Python's built-in html.parser, or lxml when it is installed. find returns the first tag that matches, and find_all returns every match. Broken markup, such as unclosed tags, still parses into a tree. Another library downloads the page first, since Beautiful Soup only parses.

Downloads / mo
289.6M
Last release
4.15.0, Jun 2026
License
MIT

Strengths

  • find and find_all. find_all() returns every matching tag, and find() returns the first.
  • Handles broken HTML. Reads pages with missing or mismatched tags.

Limitations

  • Default parser misreads broken pages. Install lxml, a faster parser, and use it for messy HTML.
  • CSS selectors only. For XPath, a way to pick page elements by path, use parsel.
  • Slower than lxml. For large pages, lxml on its own parses much faster.

Quickstart

From the docs
$ pip install beautifulsoup4
from bs4 import BeautifulSoup

with open("index.html") as fp:
    soup = BeautifulSoup(fp, 'html.parser')

soup.title.string

for link in soup.find_all('a'):
    print(link.get('href'))

print(soup.get_text())

beautifulsoup4 examples

From open-source projects on GitHub

Strips scripts, navigation, and footers from a scraped page with find_all() and decompose().

Collects article links from a category page with select(), then saves each article body.

Trafilatura is a Python package and command-line tool that downloads web pages and keeps their main text, dropping recurring parts such as headers, footers, and boilerplate. fetch_url downloads a page, and extract returns its text; with with_metadata=True, the result also includes the title, author, and date. Output formats include plain text, Markdown, CSV, JSON, HTML, XML, and XML-TEI, a format for text corpora. The package also finds new pages through sitemaps and RSS or Atom feeds.

Downloads / mo
12.9M
Stars
7.1K
Last release
2.3.1, Oct 2026
License
Apache-2.0

Strengths

  • Pulls the article text. Returns the main text with title, author, and date, minus menus and footers.
  • Exports Markdown, JSON, or XML. Also writes plain text.

Limitations

  • Skips JavaScript-loaded text. Reads static HTML only, so text added by scripts is missed.
  • Can miss text on unusual layouts. Short or link-heavy pages can come back incomplete.

Quickstart

From the README
$ pip install trafilatura
from trafilatura import fetch_url, extract

downloaded = fetch_url("https://github.blog/2019-03-29-leader-spotlight-erin-spiceland/")
print(extract(downloaded))
print(extract(downloaded, output_format="json", with_metadata=True))

trafilatura examples

From open-source projects on GitHub

Downloads a news article and extracts its full text with fetch_url() and extract().

Scrapes the readable text of a page with trafilatura and splits it into paragraphs.

Scrapy is a crawling framework maintained by Zyte. Each spider class lists its start URLs and a parse method that pulls items from every response with CSS selectors or XPath, a way to pick page elements by their path in the document. Links that parse returns go back to a scheduler, which sends requests asynchronously, so a slow or failed page doesn't hold up the others. scrapy runspider runs a single spider file, and feed exports write the items as JSON Lines, CSV, or XML.

Downloads / mo
4.3M
Stars
65.3K
Last release
2.20.0, Nov 2026
License
BSD-3-Clause

Strengths

  • Concurrent requests. Sends many requests at once across mostly static sites.
  • Built-in cleanup and export. Pipelines check each record, and exporters write JSON or CSV.

Limitations

  • No JavaScript by default. Add the scrapy-playwright plugin for pages that need a browser.
  • More setup than a script. Each crawl starts as a project folder with spider classes.

Quickstart

From the docs
$ pip install scrapy
import scrapy

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

    def parse(self, response):
        for quote in response.css("div.quote"):
            yield {
                "author": quote.xpath("span/small/text()").get(),
                "text": quote.css("span.text::text").get(),
            }

        next_page = response.css('li.next a::attr("href")').get()
        if next_page is not None:
            yield response.follow(next_page, self.parse)

# scrapy runspider quotes_spider.py -o quotes.jsonl

scrapy examples

From open-source projects on GitHub

Pulls a blog post's title and text with Scrapy CSS selectors and writes each couplet to a file.

Collects every image's attributes from a crawled page with XPath and resolves relative image URLs.

Parsel extracts data from HTML and XML with CSS selectors and XPath expressions, and from JSON with JMESPath and JSONPath, two query languages for JSON. A Selector wraps the text, css or xpath narrows it, and get or getall returns the first match or every match. re runs a regular expression on any selection. Unlike Scrapy, Parsel doesn't download pages; it parses text that another tool fetched.

Downloads / mo
3.2M
Stars
1.4K
Last release
1.12.1, Sep 2026
License
BSD-3-Clause

Strengths

  • CSS, XPath, and JSON queries. One Selector runs CSS or XPath on HTML, and JSON queries on JSON.
  • Built on lxml. Selectors run on lxml, a parser written in C.

Limitations

  • Doesn't download pages. Fetch the HTML with another tool first.
  • Can't run JavaScript. Render the page with Playwright, a browser automation tool, then parse it.

Quickstart

From the docs
$ pip install parsel
from parsel import Selector
sel = Selector(text='<div class="hero shout"><time datetime="2014-07-23 19:00">Special date</time></div>')
sel.css('.shout').xpath('./time/@datetime').getall()

parsel examples

From open-source projects on GitHub

Parses a sitemap feed with a parsel Selector and returns each listing URL with its last-modified date.

crawl4ai loads pages in a browser that Playwright controls and turns them into Markdown or structured JSON for LLM pipelines. After the pip install, a setup command installs the browser once. AsyncWebCrawler opens a crawler, and arun on a URL returns a result whose markdown field contains the page text. The open source crawler, under the Apache license, also powers a hosted API from the same team.

Downloads / mo
1.3M
Stars
87.1K
Last release
0.9.5, Oct 2026
License
Apache-2.0

Strengths

  • Turns pages into Markdown. Renders each page in a browser, then converts it to Markdown for an LLM.
  • No per-page cost. Free to run at any volume when self-hosted.

Limitations

  • A browser per crawl. Each crawl drives a headless browser, which takes more memory than an HTTP fetch. For many URLs, arun_many runs a memory-adaptive dispatcher.
  • Browser installed separately. Playwright's Chromium is installed after the package, with the setup command or python -m playwright install.

Quickstart

From the README
$ pip install crawl4ai
import asyncio
from crawl4ai import AsyncWebCrawler

async def main():
    async with AsyncWebCrawler() as crawler:
        result = await crawler.arun(url="https://news.ycombinator.com")
        print(result.markdown)

asyncio.run(main())

crawl4ai examples

From open-source projects on GitHub

Fetches a page with AsyncWebCrawler and returns its Markdown, HTML, and links.

Crawls a page in a headless browser and returns it as Markdown with citations or filtered HTML.

Scrapling combines HTTP requests, stealth browsers that render JavaScript, parsing, and concurrent crawling in one Python library. Fetcher.get downloads a page, and css or xpath selects elements from it; adaptive tracking finds an element again after the site's markup changes. Spider classes add proxy rotation, retries, pause and resume, and exports to JSON, CSV, or XML. An MCP server, a standard interface for AI tools, lets agents run the same fetches.

Downloads / mo
919.9K
Stars
99.8K
Last release
0.5.1, Nov 2026
License
BSD-3-Clause

Strengths

  • Selectors survive site changes. With adaptive=True, a selector that stops matching finds its element again.
  • Crawls and exports built in. Runs concurrent crawls with retries and exports JSON, CSV, or XML.
  • Gets past bot checks. Anti-bot evasion is built in, so blocked pages need no extra tool.

Limitations

  • One machine per crawl. Splitting a crawl across machines needs another tool.
  • API still changes. Still a 0.x release, so pin the version and read release notes before upgrading.
  • One main maintainer. Most commits come from a single author.

Quickstart

From the README
$ pip install scrapling
from scrapling.fetchers import Fetcher

page = Fetcher.get('https://quotes.toscrape.com/')
quotes = page.css('.quote .text::text').getall()
print(quotes)

Scrapling examples

From open-source projects on GitHub

Fetches a JavaScript-rendered or protected page in Scrapling's headless StealthyFetcher.

Fetches a static page over plain HTTP with Scrapling's Fetcher and stealthy headers.

Crawlee, from Apify, crawls sites through a set of crawler classes that share routing, storage, and proxy rotation. BeautifulSoupCrawler downloads pages over HTTP and parses them with Beautiful Soup, while PlaywrightCrawler drives a headless browser for pages that build their content with JavaScript. Each run writes its results to a storage folder in the working directory. Optional extras keep the base install small, and a TypeScript version shares the same design.

Downloads / mo
818.7K
Stars
9.7K
Last release
1.11.1, Nov 2026
License
Apache-2.0

Strengths

  • One API for HTTP and browsers. The same crawler code works over plain HTTP or in a full browser.
  • Parallel by default. Runs as many requests at once as the machine's CPU and memory allow.

Limitations

  • Browser crawls are slower. Use BeautifulSoupCrawler for pages that need no JavaScript.

Quickstart

From the README
$ pip install crawlee
import asyncio
from crawlee.crawlers import BeautifulSoupCrawler, BeautifulSoupCrawlingContext

async def main() -> None:
    crawler = BeautifulSoupCrawler(
        max_requests_per_crawl=10,
    )
    @crawler.router.default_handler
    async def request_handler(context: BeautifulSoupCrawlingContext) -> None:
        data = {
            'title': context.soup.title.string if context.soup.title else None,
        }
        await context.push_data(data)
    await crawler.run(['https://crawlee.dev'])

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

crawlee-python examples

From open-source projects on GitHub

Crawls a site with Crawlee's BeautifulSoupCrawler and saves each page's title, text, and links.

Crawls pages with Crawlee's PlaywrightCrawler and saves each page's URL and title.

Firecrawl turns websites into Markdown for AI agents and comes in three forms: Firecrawl Local, a single program for one machine; Firecrawl Cloud, the hosted service; and a self-hosted server. Scrape returns one page, crawl follows a site's links, and map lists its URLs. The Python SDK, installed with pip install firecrawl, works with all three, and pointing it at Firecrawl Local needs no API key. Pages that need JavaScript render in a locally installed Chrome or Chromium.

Downloads / mo
702.0K
Stars
199.8K
Last release
4.55.0, Nov 2026
License
AGPL-3.0

Strengths

  • Returns LLM-ready Markdown. Output keeps headings and links and needs no extra cleanup.

Limitations

  • Cloud-only features. Structured JSON, screenshots, browser actions, and the Agent run only on Firecrawl Cloud.
  • Rust for the local build. Firecrawl Local installs from crates.io and needs Rust and a C compiler.
  • Paid hosted API. The cloud API charges per use and has rate limits.

Quickstart

From the README
$ pip install firecrawl
from firecrawl import Firecrawl

app = Firecrawl(api_key="fc-YOUR_API_KEY")

result = app.scrape('firecrawl.dev')

firecrawl examples

From open-source projects on GitHub

Scrapes a page to Markdown with Firecrawl's scrape_url and saves it to a file.

Scrapes a job posting to clean Markdown with FirecrawlApp, returning nothing on failure.

FAQ

It depends on the job. Scrapy crawls large sites, crawl4ai reads pages that load content with JavaScript, and beautifulsoup4 parses HTML and has 289.6M downloads a month.

crawl4ai, Scrapling, crawlee-python, and firecrawl render JavaScript pages with built-in browser support. scrapy needs a plugin, and beautifulsoup4, parsel, and trafilatura read static HTML only. See the feature table.

scrapy is better for crawling whole sites: it schedules requests, follows links, and exports items to JSON or CSV. beautifulsoup4 is better for searching one page, with find() for the first match and find_all() for every match. Beautiful Soup does not crawl or follow links.

crawl4ai is a free Apache-2.0 library that runs a headless browser on the user's own machines. firecrawl is a hosted API that charges per use, with a self-hostable server that takes more setup. Both return Markdown or JSON for LLM pipelines.

crawl4ai is the closest open-source match: it renders pages in a headless browser and returns Markdown or JSON, with no per-page cost when self-hosted. Scrapling and crawlee-python also render JavaScript pages.

beautifulsoup4 parses an HTML or XML page into a tree that find(), find_all(), and CSS selectors can search. It has 289.6M downloads a month, more than any other Python scraping library.

firecrawl is a hosted API, with a self-hostable server, that scrapes, crawls, and maps sites. It returns LLM-ready Markdown or structured JSON.

For coding agents

Found your web scraping library? Help your agent use it.

Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.

Run in your terminal

claude plugin install exa@claude-plugins-official