Trafilatura vs Crawl4AI: Which Web Scraper to Use

0


Trafilatura or Crawl4AI? The answer depends on what you actually need from a web page. Both are open source, both run locally without a cloud API, both can produce Markdown, and both carry the Apache-2.0 license. Despite that overlap, they solve different problems. Picking the wrong one means either empty output or a pile of noise around the text you actually wanted.

Key Takeaways:

  • Trafilatura extracts clean article text from HTML you already have; Crawl4AI opens the page in a headless browser.
  • On our test pages Trafilatura was 2–5× faster and returned about half the text.
  • Only Crawl4AI got content that appears after JavaScript runs.
  • The strongest setup is often both: render with Crawl4AI, extract with Trafilatura.

Web Scrapers vs Content Extractors: Two Different Classes

A web scraper is a program or library that loads a page, reads its HTML (and sometimes executes its JavaScript), and extracts the data you need, such as text, links, metadata, or tables, into a structured format like JSON, CSV, or Markdown. Under that single label sit two different classes of tools:

Class
What it does
Examples

Content extractors
Take HTML that has already been downloaded and isolate the clean main text of an article
Trafilatura, newspaper4k, goose3, readability-lxml, jusText, resiliparse

Crawlers / browser automation
Fetch pages, render JavaScript when needed, follow links across a site
Crawl4AI, Crawlee, Scrapy, Playwright, Puppeteer, Scrapling, Katana, Selenium

Trafilatura is one of the most popular tools in the first class. Crawl4AI is a crawler that also does some extraction. That one difference explains almost everything else in this comparison.

Trafilatura vs Crawl4AI: Purpose of Each Tool

The two tools start from opposite ends of the same job. Trafilatura decides which part of a page is worth keeping, while Crawl4AI makes sure the page is loaded and ready for a language model to read.

Trafilatura: the article extractor

Trafilatura exists to answer one question well: which part of this HTML is the actual article? It fetches a page with a plain HTTP request, or accepts HTML you already have, and applies article heuristics similar to jusText and Readability.

Article content extraction with Trafilatura

It strips navigation, footers, “read also” blocks, promo cards and comments, and returns the body as text, Markdown, XML or JSON, optionally with metadata such as author, date and language. It does not run a browser and does not execute JavaScript.

Crawl4AI: the LLM-oriented crawler

Crawl4AI exists to turn live web pages into Markdown that a large language model or a RAG pipeline can consume. It drives a real headless Chromium through Playwright, waits for the DOM to load, executes scripts, can dismiss some overlays and cookie banners, and returns Markdown together with links, media and tables.

By default it converts nearly the whole page. To get “only the main content” you add a content filter (such as PruningContentFilter) and read the filtered fit_markdown output instead of raw_markdown.

Key Differences at a Glance

Trafilatura and Crawl4AI differ in how they get and read a page. Trafilatura makes a plain HTTP request, runs no JavaScript, and keeps only the article body. Crawl4AI renders the page in headless Chromium and returns almost all of it as Markdown, unless a pruning filter narrows it.

Trafilatura vs Crawl4AI: Key Differences Compared

Criterion
Trafilatura
Crawl4AI

Role
Extracts the article body from HTML
Crawler that opens the page itself and prepares Markdown for LLMs

How it gets the page
Plain HTTP request
Headless Chromium via Playwright

JavaScript
Not executed
Executed; waits for the DOM

What counts as “the body”
Built-in article heuristics
Almost the whole page by default; main content only through a pruning filter

Markdown output
output_format=”markdown”
fit_markdown after filtering, otherwise raw_markdown

Speed (measured, see Results)
0.9–1.4 s per page
3.9–6.7 s per page, about 2–5× slower

Cleanliness of a news body
High: related items and promos are removed
Medium: body is present, but related links and duplicates often remain

Resources
CPU only, no browser
RAM for Chromium, plus a Playwright browser install

Setup
pip install and one extract call
Browser, crawler config and filter config

License
Apache-2.0
Apache-2.0

Detailed Comparison

To extract main content from HTML in Python, each tool has a clear strength and one limit worth knowing about.

Strengths of Trafilatura

Trafilatura works best when the article text is already in the page’s HTML. Its main strengths:

  • Built for news and articles. Menus, footers, “read also” sections and promo cards usually stay out of the result.
  • Clean, readable Markdown. Paragraphs and headings are preserved. With include_links=False and favor_precision=True the output contains no stray links and leans toward dropping doubtful blocks.
  • Fast and cheap at scale. With no browser to launch, hundreds or thousands of pages can be processed on modest hardware.
  • Metadata extraction. Author, publication date, language and title are available when you need them, and can be switched off when you only want the body.
  • Minimal API. Download HTML, call extract(…, output_format=”markdown”), done.

Main limitation. If the site does not deliver the text in its initial HTML, because the content is rendered by JavaScript or the page is served as an empty shell, Trafilatura returns nothing useful. On a JavaScript-only demo page it extracted just 29 characters of page shell and none of the actual content.

Strengths of Crawl4AI

Crawl4AI covers the opposite case: pages that only make sense in a real browser. Its main strengths:

Web scraping and data collection with Crawl4AI

  • Sees the page as a browser does. It handles JavaScript-rendered content (dynamic pages) and can dismiss some cookie banners and overlays.
  • Markdown ready for RAG and LLMs, together with links, media and tables in structured form.
  • Content filtering. PruningContentFilter removes much of the navigation. Without it, a single Wikipedia article came out at about 70,000 characters of Markdown, menus included.
  • Works on “live” pages where content is drawn in after load.

Main limitation for “body only” tasks. The pruning filter is heuristic and generic. It often keeps “more stories” blocks, reviews carousels and FAQs because, to the filter, they look like dense useful text. In the news article tested below, Crawl4AI’s output was about twice as long as Trafilatura’s, and the extra length came from related-article links.

Test Results

The test looks at three things: how clean the output is, how long each tool takes, and what happens when the text is rendered by JavaScript. The results below come from two ordinary pages and two edge cases.

How We Tested

Both tools ran locally against the same pages with the same goal: return only the main text of the page as Markdown. The test ran with Trafilatura 2.3.1, Crawl4AI 0.9.4 and Python 3.14, on 4x CPU, 32GB RAM, Windows OS over a standard DSL connection.

The settings were not identical: Trafilatura was tuned for precision (favor_precision=True, include_links=False), while Crawl4AI kept its links. A run counted as a success if the tool returned the main text of the page. The test covers four pages, one day and one region, and no sites with bot protection, so treat the results as a snapshot.

  • A news article with promo blocks. A report on the Nobel Prize in Chemistry from a major online news outlet. The article is surrounded by “more stories” cards linking to other Nobel coverage. This was the main test.
  • A noisy corporate landing page. The homepage of a software company, with a menu, CTAs, a testimonial carousel and an FAQ. It is not an article, and it shows how each tool copes with a page full of banners.
  • Two more pages, a Wikipedia article and the JavaScript-rendered demo page quotes.toscrape.com/js/, are covered in the Static vs dynamic JavaScript Pages test below.

    Trafilatura vs Crawl4AI: Time and Output Size on Two Pages

    Page
    Tool
    Success
    Time (s)
    Characters
    Length vs Trafilatura

    News article
    Trafilatura
    yes
    0.94
    1,712
    1.0×

    News article
    Crawl4AI
    yes
    3.93
    3,496
    2.0×

    Landing page
    Trafilatura
    yes
    1.40
    6,153
    1.0×

    Landing page
    Crawl4AI
    yes
    6.72
    12,256
    2.0×

    News Article: Did Only the Body Come Through?

    Both tools captured the article itself: the laureates, the explanation of mirror-image isomers, the note on the previous year’s prize and the dates of upcoming announcements.

    News Article: Body vs Promo Content

    Check
    Trafilatura
    Crawl4AI

    Article paragraphs
    Present, separated by blank lines
    Present, but merged into dense blocks without paragraph breaks

    Site menu, subscription prompts, footer
    Absent
    Absent

    “Read also” cards
    Absent
    Present: stories on other Nobel prizes and unrelated science

    Duplicates of those cards
    None
    Yes: the same link appears both as a heading and as a list item

    Links in the body
    Disabled on purpose
    Related links remained

    Time
    0.94 s
    3.93 s

    Verdict: Trafilatura delivered the clean article body. Crawl4AI also got the body, but roughly half of its output was promo cards next to the article. For “just the article as .md”, that is the weaker result.

    Landing Page: Banners and Noise

    A landing page has no “article body”, so both tools extract marketing copy. The difference is how many banners and repeats come along with it.

    Landing Page Test: What Each Tool Kept and Dropped

    Check
    Trafilatura
    Crawl4AI

    Section headings (#, ##)
    Preserved
    Almost no structure; one long run of text

    CTA button labels (“Get Started” etc.)
    Ended up in the text
    Some disappeared along with the layout

    Technology names (.NET, Java, PHP)
    Intact
    Lost in one paragraph, which read “including , , ,”

    Client testimonials
    Present
    Present and duplicated by the carousel (one testimonial repeated three times)

    FAQ and product cards
    Partially
    More complete, though no longer really “main text”

    Size (characters)
    6,153
    12,256

    Neither tool produces perfectly clean text from a landing page. Trafilatura is more compact and keeps the headings. Crawl4AI is more complete but carries carousel duplicates and occasional gaps.

    Static vs JavaScript Pages

    Two more pages show the boundary between the tools that the news test does not reveal:

    Wikipedia and a JavaScript Demo Page: Results by Tool

    Page
    Trafilatura
    Crawl4AI
    What it means

    Wikipedia article (static HTML)
    ~0.6 s, ~26k characters of clean text
    ~1.3–2.1 s, ~70k characters of Markdown including navigation
    Without a content filter Crawl4AI drags in the menus. Trafilatura goes straight to the article

    quotes.toscrape.com/js/ (JavaScript-rendered)
    ~0.8–1.0 s, 29 characters (page shell only)
    ~1.7–1.9 s, ~1.7k characters, all quotes present
    When the text exists only after JavaScript runs, Trafilatura gets nothing and Crawl4AI succeeds

    Conclusions from the Test

  • News page with banners, body only, as Markdown: Trafilatura wins. It returned 1,712 characters of pure article. Crawl4AI returned the same paragraphs plus promo links (3,496 characters).
  • Speed: Trafilatura was about 4–5× faster on both pages (0.9–1.4 s vs 3.9–6.7 s) and 2–3× faster on the Wikipedia and JavaScript pages. It also needs no Chromium.
  • Markdown quality: Trafilatura keeps paragraphs and headings. Crawl4AI’s paragraphs merge into dense blocks, and rotating blocks are more often duplicated.
  • Where Crawl4AI is required: when the content is not in the source HTML. Even then, getting “body only” output from a browser still requires a filter, and that filter is weaker than Trafilatura’s heuristics.
  • Python Web Scraping Libraries and Other Open-Source Tools Compared

    All of the projects below publish their source code under an open license. Some (Firecrawl, CRW, Jina Reader) also sell a commercial cloud service; the table describes the self-hosted / open-source edition. Licenses reflect the public repositories at the time of writing, so check the current LICENSE file before using one in production.

    Open-Source Scraping Tools Compared by Language, Type, JavaScript Support and License

    Tool
    Language
    Type
    JS
    License
    In short

    Trafilatura
    Python
    Extractor
    No
    Apache-2.0
    Benchmark for article text extraction

    Crawl4AI
    Python
    Crawler + extractor
    Yes
    Apache-2.0
    LLM-friendly crawler, Markdown for RAG

    newspaper4k
    Python
    Article extractor
    No
    MIT
    News text, author, date; little boilerplate

    goose3
    Python
    Article extractor
    No
    Apache-2.0
    Classic article extractor (port of Goose)

    readability-lxml
    Python
    Extractor
    No
    Apache-2.0
    Port of Readability.js (Firefox Reader View)

    jusText
    Python
    Boilerplate remover
    No
    BSD-2
    Strips menus and ads from HTML

    resiliparse
    Python / C++
    Extractor
    No
    Apache-2.0
    Fast main-content extraction from HTML / WARC

    Scrapy
    Python
    Crawler framework
    Partial
    BSD-3
    Industrial-scale data collection

    Crawlee
    Python / JS
    Crawler framework
    Yes
    Apache-2.0
    Queues, proxies, deduplication

    Colly
    Go
    Crawler framework
    No
    Apache-2.0
    Lightweight, fast Go crawler

    Katana
    Go
    Crawler / URL discovery
    Partial
    MIT
    Fast CLI crawler from ProjectDiscovery

    StormCrawler
    Java
    Crawler (Apache Storm)
    Yes
    Apache-2.0
    Low-latency crawling pipelines

    Playwright
    Python / JS / .NET
    Browser automation
    Yes
    Apache-2.0
    Chromium, Firefox, WebKit

    Puppeteer
    Node.js
    Browser automation
    Yes
    Apache-2.0
    The standard headless Chrome library for JS

    Selenium
    Many
    Browser automation
    Yes
    Apache-2.0
    Classic WebDriver

    Scrapling
    Python
    Adaptive scraper
    Yes
    BSD-3
    Self-healing selectors

    Firecrawl (self-hosted)
    TypeScript
    Crawler + API
    Yes
    AGPL-3.0
    URL to Markdown / JSON

    CRW (fastCRW)
    Rust
    Crawler + API
    Yes
    AGPL-3.0
    Firecrawl-compatible API, lightweight self-host

    Jina Reader (OSS)
    TypeScript
    URL to Markdown
    Yes
    Apache-2.0
    Code behind r.jina.ai; models may be licensed separately

    MarkItDown
    Python
    Document converter
    No
    MIT
    PDF / Word / PPT / Excel to Markdown

    ScrapeGraphAI
    Python
    LLM scraper
    Yes
    MIT
    Scraping driven by a natural-language prompt

    In this web scraping tools comparison, the closest Trafilatura alternatives are newspaper4k, goose3, readability-lxml and jusText, so trafilatura vs readability is about extraction heuristics, not JavaScript.

    Among crawl4ai alternatives, Firecrawl and Jina Reader also convert web pages into LLM-ready content. For crawl4ai vs firecrawl, licensing is a key difference: Apache-2.0 versus AGPL-3.0. All three support self-hosting, while managed services are available separately. This matters when evaluating firecrawl alternatives or a jina reader alternative.

    What Should You Use?

    There is no single best scraper. The right choice depends on where the content lives and what you need to do with it, whether that is a web scraper for LLM prompts or a web scraper for RAG pipelines.

    Recommended Web Scraping Tools by Use Case

    Situation
    Use

    Publicly accessible article; you need only the article text as Markdown
    Trafilatura

    The text appears only after JavaScript runs
    Crawl4AI

    Many static articles where speed and cleanliness matter
    Trafilatura

    You want the full page as Markdown for an LLM, and some noise is acceptable
    Crawl4AI

    Crawling a large site at scale
    Scrapy, StormCrawler, Colly, Katana

    Converting PDFs and office documents for RAG
    MarkItDown

    The Best of Both: Combine Them

    The two tools are not rivals so much as two halves of a pipeline. A common and effective pattern:

  • Fetch and render with Crawl4AI (or plain Playwright) so JavaScript-generated content is present.
  • Extract the rendered HTML with Trafilatura to get a clean article body with paragraphs and headings.
  • Combining web crawling and content extraction

    This gives you the browser’s reach with the extractor’s precision, and avoids the related-links and carousel duplicates that Crawl4AI’s own pruning filter tends to leave behind.

    Render with Crawl4AI, Extract with Trafilatura

    The script below renders the page in a browser and passes the resulting HTML to Trafilatura. Run crawl4ai-setup once to install the browser.

    import asyncio
    from crawl4ai import AsyncWebCrawler
    from trafilatura import extract

    async def main():
    url = “https://example.com/article”

    async with AsyncWebCrawler() as crawler:
    result = await crawler.arun(url=url)

    if not result.success:
    raise RuntimeError(result.error_message)

    markdown = extract(result.html, output_format=”markdown”)
    print(markdown or “No article content found”)

    asyncio.run(main())

    How to Convert a Web Page to Markdown in Python

    For static pages, the simplest HTML to Markdown Python approach is to call Trafilatura directly:

    from trafilatura import fetch_url, extract

    html = fetch_url(“https://example.com/article”)

    markdown = extract(html, output_format=”markdown”) if html else None

    print(markdown or “No content found”)

    When building a website to markdown pipeline, start with Trafilatura and use Crawl4AI as a fallback if extraction returns empty or unexpectedly short output. Set the minimum length from your own pages: in our test, a JavaScript page returned only 29 characters from Trafilatura, while the static pages returned from 1,712 to about 26,000 characters.

    Use Cases

    The choice between Trafilatura and Crawl4AI depends on the type of website, the content you need, and whether JavaScript rendering is required. Here are the scenarios where each approach makes sense.

    Trafilatura is the right fit for:

    When the main goal is to extract clean article text from static pages, Trafilatura is usually the simpler option.

    • News monitoring and media analysis across hundreds or thousands of outlets.
    • Building text corpora for NLP research or language-model training.
    • Archiving articles in clean Markdown or XML.
    • Feeding a summarizer or classifier with article bodies free of navigation noise.
    • Batch processing of already-downloaded HTML or WARC archives.
    • Low-resource environments where launching a browser per page is too expensive.

    Web scraping automation for different use cases

    Crawl4AI is the right fit for:

    When the page needs a browser or the output feeds an LLM, Crawl4AI is usually the simpler option.

    • RAG pipelines and AI agents that need web content as LLM-ready Markdown.
    • Single-page applications and sites that render content client-side.
    • Collecting links, media and tables along with text.
    • Pages that need interaction before the content shows up: closing overlays, scrolling, waiting for lazy loading.
    • Exploratory scraping where you want the whole page and will filter later.

    Use both together when:

    Some projects need browser rendering and precise text extraction, making a combined workflow useful.

    • The page needs a browser to render, but the output must be a clean article body.
    • You run a mixed source list: try Trafilatura first for speed and fall back to Crawl4AI rendering when it returns empty or near-empty output.

    Is Web Scraping Legal? What to Check Before You Start

    Legality depends on the site, the data and the jurisdiction, and this is not legal advice. Before you start, check five things:

    • robots.txt. It states which paths a site asks bots not to visit. In Crawl4AI, checking it is controlled by the check_robots_txt option in CrawlerRunConfig, which is off by default in the current documentation.
    • Terms of service. Some sites forbid automated access, and logging in usually means accepting those terms.
    • Personal data. Names, emails and profiles fall under rules such as GDPR, even when the pages are public.
    • Copyright. Article text and images usually belong to their authors, so collecting them does not mean you may republish them.
    • Server load. Limit request rates so your crawler does not slow the site down.

    How SCAND Uses Web Data in AI Projects

    At SCAND, web data is one input among several in AI projects. For a client in Europe, we built an agentic AI platform where non-technical staff create and manage AI agents through a chat interface.

    Web data processing for AI projects

    Crawl4AI collects data from external sources, Tavily also supports web data collection, and Docling processes documents, while LangChain and LangGraph orchestrate the agents. Teams can run multi-source research without a separate custom solution for every task.

    In a Crawl4AI RAG pipeline, the crawler brings pages in as Markdown, a document parser handles files, and the retrieval layer searches over both. Not every RAG system needs web data: our RAG support chatbot boilerplate answers from a company’s own knowledge base and documentation.

    Need web data for a RAG system or an AI agent? We design and build the pipeline.

    Summary

    Trafilatura is a widely used choice for clean text extraction from articles and news. On our news and landing pages it returned about half the text of Crawl4AI, with paragraphs and headings intact and no related-article links, and across all four pages it was 2–5× faster. Its blind spot is anything that is not in the initial HTML.

    Crawl4AI is the tool for dynamic pages and LLM pipelines. It reaches content Trafilatura cannot, but when you want only the article body, its output often keeps related-content blocks and carousel duplicates.

    In practice, the strongest setup is often a combination: a browser to fetch the page, and Trafilatura to clean it.

    Frequently Asked Questions (FAQs)

    What is the difference between Trafilatura and Crawl4AI?

    Trafilatura extracts the main article text from HTML, using a plain HTTP request or HTML you already have, and does not run JavaScript. Crawl4AI opens the page in headless Chromium, executes scripts and returns almost the whole page as Markdown. In our test, Trafilatura was 2–5× faster and returned cleaner article text.

    Which web scraper is best for RAG and LLM pipelines?

    It depends on the source. For article pages with static HTML, Trafilatura gives clean text quickly. For JavaScript-rendered pages, Crawl4AI is the practical choice because it returns Markdown after rendering. For PDFs and Office files, MarkItDown converts documents. Many pipelines combine two of these rather than relying on one.

    Can Trafilatura scrape JavaScript pages?

    Not by itself. Trafilatura does not run a browser or execute JavaScript, so it only sees the HTML the server sends. On a JavaScript-rendered demo page it returned 29 characters of page shell. To scrape such pages, render them first with Crawl4AI or Playwright and pass the resulting HTML to Trafilatura.

    Can you use Trafilatura and Crawl4AI together?

    Yes. Crawl4AI renders the page in a browser, and Trafilatura extracts the article body from the rendered HTML. This keeps the browser’s reach for JavaScript content while Trafilatura’s heuristics typically remove navigation and promo blocks. Pass the rendered HTML from Crawl4AI to Trafilatura’s extract function. We did not benchmark this combination.

    Is Crawl4AI free for commercial use?

    Yes. Crawl4AI is open source under the Apache-2.0 license, which allows commercial use. The repository’s LICENSE file adds an attribution requirement: public uses must credit the project. License terms were checked on October 27, 2026 (latest PyPI release 0.9.5), so review the current LICENSE file before shipping a product.

    Is web scraping legal?

    It depends on the site, the data and the country, so this is not legal advice. Check robots.txt, the site’s terms of service, whether the pages contain personal data covered by rules such as GDPR, who holds the copyright to the content, and whether your request rate could overload the server. For a specific project, ask a lawyer.

    How do you convert a web page to Markdown in Python?

    For static pages, fetch the HTML and pass it to Trafilatura’s extract function with the Markdown output format; this is the simplest HTML to Markdown Python route. For JavaScript-rendered pages, let Crawl4AI render the page first and then extract. Either way, it takes only a few lines of code.



    Source link

    You might also like