Skip to the content.

Firecrawl Alternatives: Open-Source Tools and Python Recipes to Turn Web Pages into LLM-Ready Markdown

A practical guide to web scraping for LLMs: how to fetch pages politely, strip boilerplate, convert HTML to clean Markdown, chunk it for RAG, and stay on the right side of robots.txt, terms of service and AI-crawler etiquette. It compares Firecrawl alternatives (Crawl4AI, Jina Reader, Trafilatura, Scrapy, Crawlee, Docling, MarkItDown, ScrapeGraphAI and more) and ships llmscrape, a small, tested, standard-library Python package that does polite fetching, main-content extraction, Markdown conversion, sitemap parsing, crawling and chunking.

For developers building RAG pipelines, AI agents that read the web, dataset builders and anyone who needs web content in a form a model can use.

Last reviewed: December 2026. Tool details (licenses, features, hosting) were checked against each project’s repository or docs at review time. Not affiliated with any tool listed. Nothing here is legal advice.


Table of Contents


Why “LLM-ready” content is different

A browser renders HTML for humans. A model reads tokens. Raw HTML is a poor input:

Raw HTML problem Effect on an LLM pipeline
70 to 95% of bytes are markup, scripts and styles on many pages You pay for tokens that carry no meaning; context fills up
Navigation, footers, cookie banners repeated on every page Duplicate noise dominates embeddings and retrieval
Content split across div soup Headings and lists lose their structure
Relative links and tracking parameters Citations break or leak tracking
JavaScript-rendered content A plain HTTP fetch returns an empty shell

LLM-ready output is:


The pipeline in one picture

 seed URLs / sitemap
        │
        ▼
  robots.txt check ──► disallowed? skip
        │
        ▼
  polite fetch (UA, rate limit, retries, size cap) ──► needs JS? render with a headless browser
        │
        ▼
  main-content extraction (drop nav, footer, ads, banners)
        │
        ▼
  HTML → Markdown (headings, lists, tables, code, links absolute, tracking stripped)
        │
        ▼
  clean (dedupe boilerplate lines, collapse whitespace) + front matter metadata
        │
        ▼
  chunk by headings ──► embed / index / prompt

Quick start with llmscrape

llmscrape is a reference implementation of the pipeline above in about 700 lines of standard-library Python. No installs.

git clone https://github.com/Ralpberry-Labs/firecrawl-alternatives.git
cd firecrawl-alternatives

# One page to Markdown with YAML front matter
python3 -m llmscrape https://docs.python.org/3/library/urllib.robotparser.html

# Crawl a site (same host, depth 2, max 20 pages), one .md file per page
python3 -m llmscrape https://example.org/docs/ --crawl --max-pages 20 --out corpus/

# Chunks as JSON lines, ready for an embedding job
python3 -m llmscrape https://example.org/docs/intro --jsonl > chunks.jsonl

In Python:

from llmscrape import PoliteFetcher, extract_main, chunk_markdown

fetcher = PoliteFetcher(user_agent="my-rag-bot/1.0 (+https://example.org/bot)", min_delay=2.0)
res = fetcher.get("https://docs.python.org/3/howto/urllib2.html")
if res.ok:
    doc = extract_main(res.text, res.url)
    print(doc.title)
    for chunk in chunk_markdown(doc.markdown, max_tokens=400, url=doc.url):
        print(chunk["heading"], len(chunk["text"]))
else:
    print("skipped:", res.skipped)

What it does for you:

Feature Module
robots.txt allow/deny, Crawl-delay, sitemap discovery, per-origin cache robots.py
Honest user agent, per-host rate limit, retries with backoff and Retry-After, gzip, size cap fetch.py
Boilerplate removal and main-content detection (main/article, then text density) extract.py
HTML → Markdown: headings, nested lists, tables, code fences with language, blockquotes, images, links extract.py
Tracking parameter removal, repeated-line cleanup clean.py
Sitemap and sitemap index parsing sitemap.py
Same-site breadth-first crawl with URL normalization crawl.py
Heading-aware chunking that never splits code blocks chunk.py

Limits, honestly: it does not run JavaScript, it uses heuristics rather than machine learning for main-content detection, and the standard-library HTML parser is slower than C-based parsers. For those needs, use the tools below; the ideas carry over.

Run the tests (offline; a local HTTP server stands in for websites):

python3 -m unittest discover -s tests

Tool landscape

Licenses as declared in each repository at review time. AGPL and GPL licenses have obligations if you modify and distribute or offer the software as a network service; check before embedding in a product.

All-in-one crawlers for LLMs

Tool License Language Highlights Hosting
Firecrawl AGPL-3.0 TypeScript (SDKs in several languages) Scrape, crawl, map and search endpoints returning Markdown or structured data; handles JS rendering Hosted API at firecrawl.dev or self-host
Crawl4AI Apache-2.0 Python Async crawler built on a headless browser, Markdown output, content filters, extraction strategies, many-URL dispatching Self-host; the project also offers a hosted service
Scrapling BSD-3-Clause Python Scraping framework with adaptive selectors and multiple fetchers (HTTP and browser) Self-host
Spider MIT Rust Very fast crawler library with Markdown transformation options Self-host or hosted service
ralpcrawl MIT TypeScript Local Firecrawl-compatible scraper with an MCP server, by Ralpberry Labs (the publisher of this guide) Self-host

URL-to-Markdown services

Tool License How it works Notes
Jina Reader Apache-2.0 Prefix a URL: https://r.jina.ai/https://example.org/page returns Markdown Free tier with rate limits; API key raises limits. Open-source code available
Firecrawl hosted API AGPL (self-host) / commercial (hosted) POST /scrape with a URL Pay per page credits on the hosted plan
Crawl4AI hosted see project Hosted version of the open-source crawler Check current plans

Services are the fastest way to start; you trade cost, rate limits and sending URLs (and content) through a third party.

Content extraction libraries

These find the main text of a page (the “article”) and discard the rest.

Tool License Language Best at
Trafilatura Apache-2.0 Python Accurate main-text and metadata extraction; outputs TXT, Markdown, JSON, XML; includes crawling and feed/sitemap helpers. Docs
Readability.js Apache-2.0 JavaScript The algorithm behind Firefox Reader View; great for article pages in Node or the browser
python-readability Apache-2.0 Python Python port of the readability approach
Newspaper4k MIT Python News articles: authors, dates, top image, text

HTML-to-Markdown converters

Converters translate whatever HTML you give them. Pair them with an extractor, or feed them only the content element.

Tool License Language Notes
markdownify MIT Python Simple, configurable (heading_style="ATX", strip tags)
html2text GPL-3.0 Python Long-standing converter; note the GPL license
llmscrape.extract (this repo) MIT Python, stdlib Extraction + conversion in one step, no dependencies

Fast HTML parsing in Python: selectolax (MIT, C-based) and Beautiful Soup (friendly API, pluggable parsers).

Crawling frameworks

For large or long-running crawls with queues, retries, proxies and storage:

Tool License Language Notes
Scrapy BSD-3-Clause Python Mature, fast, huge ecosystem of middlewares; add Playwright via plugins for JS
Crawlee (Node.js) Apache-2.0 TypeScript HTTP and browser crawlers with queues, sessions and autoscaling
Crawlee for Python Apache-2.0 Python The same model for Python
Playwright Apache-2.0 Many Headless browser automation for JS-heavy pages

Document converters (PDF, Office)

Web pages link to PDFs, slides and spreadsheets. Convert those with:

Tool License Notes
MarkItDown MIT Many formats (PDF, Word, PowerPoint, Excel, HTML, images with OCR via plugins) to Markdown
Docling MIT Layout-aware PDF and document conversion, tables, reading order; Markdown and JSON export
Unstructured Apache-2.0 Partitions many document types into typed elements for RAG

LLM-based extraction

When you need structured fields from messy pages, let a model fill a schema:

Tool License Language Notes
ScrapeGraphAI MIT Python Describe what you want in a prompt; graph pipelines fetch, parse and extract
LLM Scraper MIT TypeScript Schema-based extraction with Playwright and an LLM
Crawl4AI and Firecrawl extraction modes see above   Schema extraction built into the crawler

Best picks by situation

Situation Pick Why
A few pages into a prompt right now Jina Reader, or python3 -m llmscrape URL Zero setup
Docs site into a RAG index, self-hosted Trafilatura or llmscrape + sitemap Accurate text, no browser needed for static docs
JS-heavy sites at moderate scale, open source Crawl4AI Browser rendering and Markdown output built in
Hosted API with SDKs and no infrastructure Firecrawl hosted, Jina Reader, or similar services Pay per page, nothing to run
Millions of pages, custom logic Scrapy or Crawlee + an extractor Battle-tested scheduling and storage
News articles with authors and dates Newspaper4k or Trafilatura Metadata extraction
PDFs and Office documents Docling or MarkItDown Layout and tables
Structured fields (prices, specs) from varied sites ScrapeGraphAI, LLM Scraper, or a schema extraction mode Model handles layout differences
No dependencies allowed (air-gapped, minimal containers) llmscrape Standard library only

Recipes

1. One page to Markdown

Standard library (this repo):

from llmscrape import PoliteFetcher, extract_main
res = PoliteFetcher(user_agent="docs-reader/1.0 (+https://example.org/bot)").get("https://example.org/post")
print(extract_main(res.text, res.url).with_front_matter() if res.ok else res.skipped)

Trafilatura (pip install trafilatura):

import trafilatura
downloaded = trafilatura.fetch_url("https://example.org/post")
markdown = trafilatura.extract(downloaded, output_format="markdown", with_metadata=True, include_links=True)

markdownify on a selected element (pip install markdownify beautifulsoup4):

from bs4 import BeautifulSoup
from markdownify import markdownify as md

soup = BeautifulSoup(html, "html.parser")
main = soup.find("main") or soup.find("article") or soup.body
for tag in main.select("nav, footer, aside, script, style, form"):
    tag.decompose()
markdown = md(str(main), heading_style="ATX")

Jina Reader (hosted):

curl -s "https://r.jina.ai/https://example.org/post"

2. A whole docs site from its sitemap

Sitemaps are the most polite way to enumerate a site: the owner published the list.

from llmscrape import PoliteFetcher, RobotsCache, parse_sitemap, extract_main

UA = "docs-indexer/1.0 (+https://example.org/bot)"
fetcher = PoliteFetcher(user_agent=UA, min_delay=1.5)
site = "https://docs.example.org"

sitemap_urls = fetcher.robots.sitemaps(site + "/") or [site + "/sitemap.xml"]
pages = []
while sitemap_urls:
    res = fetcher.get(sitemap_urls.pop())
    if res.ok:
        found, children = parse_sitemap(res.text)
        pages += found
        sitemap_urls += children

for url, lastmod in pages[:200]:
    r = fetcher.get(url)              # robots.txt and rate limits applied for every request
    if r.ok:
        doc = extract_main(r.text, r.url)
        save(doc, lastmod)            # your storage

Prefer lastmod to decide what to re-fetch later (Recipe 6).

3. JavaScript-rendered pages

Symptoms: the fetched HTML has an empty <div id="root"></div> and little text.

Options, cheapest first:

  1. Look for the data source. Many apps load JSON from an API endpoint visible in the browser’s network tab. If its use is permitted, it is cleaner than any HTML.
  2. Check for server-rendered alternatives: an /amp version, RSS/Atom feeds, ?format= parameters, or the site’s own Markdown sources (docs sites often link “Edit on GitHub”).
  3. Render with a headless browser, then extract:
# pip install playwright && playwright install chromium
from playwright.sync_api import sync_playwright
from llmscrape import extract_main

with sync_playwright() as p:
    browser = p.chromium.launch()
    page = browser.new_page(user_agent="docs-reader/1.0 (+https://example.org/bot)")
    page.goto("https://example.org/app/page", wait_until="networkidle")
    html = page.content()
    browser.close()

print(extract_main(html, "https://example.org/app/page").markdown)
  1. Use a crawler that renders for you (Crawl4AI, Firecrawl, Crawlee’s browser crawlers):
# pip install -U crawl4ai && crawl4ai-setup
import asyncio
from crawl4ai import AsyncWebCrawler

async def main():
    async with AsyncWebCrawler() as crawler:
        result = await crawler.arun(url="https://example.org/app/page")
        print(result.markdown)

asyncio.run(main())

Browser rendering is 10 to 100 times more expensive than an HTTP fetch. Check robots.txt the same way; a headless browser is still a bot.

4. Structured data with a schema

Before reaching for an LLM, check for data the page already exposes:

import json, re
# JSON-LD (schema.org) blocks: products, articles, events, recipes, FAQs
blocks = re.findall(r'<script[^>]+type="application/ld\+json"[^>]*>(.*?)</script>', html, re.S | re.I)
data = [json.loads(b) for b in blocks]

Also look at Open Graph <meta property="og:..."> tags and microdata. When those are missing, extract with a model and validate:

Extract the product from the page below as JSON matching this schema.
Use null for anything not present on the page. Do not guess.
{"name": str, "price": number|null, "currency": "ISO 4217"|null, "in_stock": bool|null, "sku": str|null}

<page>
{markdown}
</page>

Validate types and ranges in code, and spot-check a sample by hand. Feed the model the cleaned Markdown, not raw HTML: it is cheaper and models extract from it more reliably.

5. Chunks ready for embeddings

from llmscrape import chunk_markdown
chunks = chunk_markdown(doc.markdown, max_tokens=400, url=doc.url)
# [{"heading": "Install > Linux", "text": "...", "url": "https://..."}, ...]
for c in chunks:
    text_for_embedding = f"{doc.title}\n{c['heading']}\n\n{c['text']}"

Prepending title and heading path to each chunk makes short chunks retrievable (“Linux” alone is ambiguous; “Install > Linux” is not). Keep url and an anchor for citations.

6. Keeping a corpus fresh

7. PDFs and Office files linked from pages

pip install 'markitdown[all]'
markitdown report.pdf > report.md
# pip install docling
from docling.document_converter import DocumentConverter
md = DocumentConverter().convert("https://example.org/whitepaper.pdf").document.export_to_markdown()

Scanned PDFs need OCR; both tools document OCR options. Check file size before downloading and respect the same robots and rate limits.


Cleaning rules that matter for LLMs

Rule Why
Keep headings as # Markdown Chunking and retrieval rely on structure
Keep tables as Markdown tables Models read pipe tables well; flattened cells lose meaning
Keep code in fenced blocks with the language Prevents models from “fixing” code as prose
Make links absolute, strip utm_*, fbclid, gclid Clean citations, no tracking leaks
Drop nav, footer, sidebars, cookie banners, share widgets, comments (unless wanted) Noise and duplicates
Drop hidden elements (hidden, aria-hidden, display:none) Hidden text can carry spam or prompt injection
Remove lines repeated across many pages Leftover boilerplate
Keep image alt text, drop decorative images Alt text carries meaning; images without alt usually do not
Normalize whitespace and Unicode Stable hashes and fewer tokens
Record title, URL, language, fetch time Citations, filtering, freshness

Security note: scraped pages are untrusted input. Pages can contain text written to manipulate AI systems (“ignore previous instructions…”), sometimes hidden with CSS. Dropping hidden elements helps; treating all scraped text as data, never as instructions, is the real rule when you pass it to an agent.


Robots.txt, rate limits and etiquette

RFC 9309 standardized the Robots Exclusion Protocol in 2022. Key points for a scraper:

Python’s standard library handles parsing:

import urllib.robotparser
rp = urllib.robotparser.RobotFileParser("https://example.org/robots.txt")
rp.read()
rp.can_fetch("my-bot", "https://example.org/private/page")   # False if disallowed
rp.crawl_delay("my-bot")                                      # None or seconds
rp.site_maps()                                                # list or None

llmscrape.RobotsCache wraps this with caching and the 4xx/5xx rules above.

Etiquette that keeps you from getting blocked (and from hurting small sites):

  1. Identify yourself: a user agent with a name and a contact URL, e.g. docs-indexer/1.0 (+https://example.org/bot).
  2. One request at a time per host, with a delay (1 to 5 seconds is common for small sites).
  3. Back off on 429 and 503, honor Retry-After.
  4. Cache and use conditional requests; do not re-download unchanged pages.
  5. Crawl off-peak for large jobs and set a page budget.
  6. Stop if the site owner asks, and provide a way to be contacted.

AI crawler user agents

Major AI companies publish the user agents of their crawlers so site owners can allow or block them in robots.txt. If you build your own crawler, pick a unique, honest name rather than reusing these.

Operator Tokens (as documented at review time) Documentation
OpenAI GPTBot, OAI-SearchBot, ChatGPT-User, OAI-AdsBot OpenAI crawlers
Anthropic ClaudeBot, Claude-SearchBot, Claude-User Anthropic crawler FAQ
Google Google-Extended (a robots.txt control token for AI uses), GoogleOther, Google-CloudVertexBot Google crawlers
Apple Applebot-Extended (control token) About Applebot
Perplexity PerplexityBot, Perplexity-User Perplexity crawlers
Common Crawl CCBot CCBot

Vendors distinguish training/indexing crawlers from user-triggered fetchers (a person asked an assistant to open a page), and some state that robots.txt rules apply differently to the latter. Read each page for specifics.

Example robots.txt for a site that allows search and user-triggered fetches but opts out of AI training crawlers:

User-agent: GPTBot
Disallow: /

User-agent: ClaudeBot
Disallow: /

User-agent: Google-Extended
Disallow: /

User-agent: CCBot
Disallow: /

User-agent: *
Allow: /
Sitemap: https://example.org/sitemap.xml

CDNs also offer bot controls; for example, Cloudflare documents AI crawl controls for site owners.


Not legal advice; laws differ by country and change. When the stakes are real, ask a lawyer.


If you run a website: be LLM-friendly

If you want AI tools to represent your site accurately:


Feature comparison at a glance

Tool JS rendering Crawl a site Markdown output Structured extraction Self-host Hosted option
Firecrawl Yes Yes Yes Yes (schema / prompt) Yes (AGPL-3.0) Yes
Crawl4AI Yes (browser) Yes Yes Yes (CSS, XPath or LLM strategies) Yes (Apache-2.0) Yes
Jina Reader Yes No (single URLs) Yes Limited Yes (Apache-2.0 code) Yes
Trafilatura No Yes (helpers) Yes Metadata only Yes (Apache-2.0) No
Scrapy Via plugins Yes Via your code Via your code Yes (BSD-3-Clause) Third-party
Crawlee Yes (browser crawlers) Yes Via your code Via your code Yes (Apache-2.0) Via Apify
ScrapeGraphAI Yes Limited Yes Yes (LLM) Yes (MIT) Yes
llmscrape (this repo) No Yes (same host) Yes No Yes (MIT) No

“Via your code” means the framework fetches and parses, and you add HTML-to-Markdown and extraction with libraries from this guide.


Measuring extraction quality

Before switching tools, measure on your own pages:

  1. Collect 30 to 50 representative URLs (article pages, docs, product pages, a few JavaScript-heavy ones).
  2. Write the expected main text for 10 of them by hand (or carefully clean one tool’s output).
  3. Run each tool and score:
    • Recall: share of expected sentences present in the output.
    • Precision: share of output sentences that are real content (not menus, footers, ads).
    • Structure: headings, lists, tables and code preserved (spot check).
    • Links: absolute, correct, tracking removed.
    • Cost and time per page.
  4. Check failure modes: empty outputs, cookie-banner outputs, truncated long pages, duplicated content.

A simple sentence-level comparison is enough to rank tools:

import re
def sentences(t):
    return {s.strip().lower() for s in re.split(r"(?<=[.!?])\s+", t) if len(s.split()) > 4}
expected, got = sentences(open("expected.md").read()), sentences(open("tool_output.md").read())
recall = len(expected & got) / max(1, len(expected))
precision = len(expected & got) / max(1, len(got))
print(f"recall={recall:.2f} precision={precision:.2f}")

Glossary


Troubleshooting

Symptom Cause Fix
Output nearly empty Content rendered by JavaScript See Recipe 3
Output is the cookie banner or menu Main-content detection picked the wrong block Use main/article selectors for that site, try Trafilatura, or pass the content element explicitly
403 Forbidden Bot protection or blocked user agent Respect it; ask the site for access or use an API. Do not spoof browsers to evade blocks
429 Too Many Requests Too fast Increase delay, honor Retry-After, crawl fewer pages
Garbled characters Wrong encoding Use the charset from headers or <meta charset>; normalize to UTF-8
Duplicate pages in corpus URL variants (?utm_, trailing slash, http vs https) Normalize URLs (llmscrape.normalize_url), use canonical links (<link rel="canonical">)
Tables become word soup Converter without table support Use a converter with Markdown tables (llmscrape, Trafilatura, markdownify)
Code blocks lose indentation Whitespace collapsed Preserve whitespace inside <pre>; fence code blocks
Crawl never ends Calendars, filters, session IDs create infinite URLs Depth and page limits, URL pattern allowlists, strip session parameters
Model answers with hidden spam text Hidden elements kept Drop hidden elements; treat content as untrusted

FAQ

What is the best free alternative to Firecrawl? For self-hosting with JavaScript rendering, Crawl4AI is the most common open-source choice. For static sites and docs, Trafilatura (or this repo’s llmscrape) is lighter and needs no browser. For quick one-off pages, a URL-to-Markdown service such as Jina Reader is the least effort. Pick by whether you need JS rendering, scale and hosting.

Is web scraping legal? It depends on the country, what you collect, how, and what you do with it. Publicly accessible pages, respect for robots.txt and terms, no personal data, and no circumvention of access controls keep you on safer ground. This is not legal advice.

Why convert HTML to Markdown instead of plain text? Markdown keeps structure (headings, lists, tables, code) at a fraction of HTML’s token cost. That structure helps chunking, retrieval and the model’s understanding. Plain text loses it.

How many tokens does a web page use? After cleaning, a typical article is a few thousand tokens; the raw HTML of the same page is often many times larger. Use llmscrape.estimate_tokens for a rough count and your model’s tokenizer for exact numbers.

Do I need a headless browser? Only for pages whose content is rendered by JavaScript. Try a plain HTTP fetch first; it is much faster and cheaper.

Should my scraper obey robots.txt even for a small script? Yes. It is the site owner’s stated preference, it is easy to check (urllib.robotparser), and it keeps you out of trouble.

How do I scrape a site that blocks bots? Ask for permission or an API, or use a licensed data provider. Evading blocks (rotating fake user agents, solving CAPTCHAs) is against the site’s wishes and often its terms.

Can I use scraped content to train a model? That is a legal and licensing question that varies by jurisdiction and content. Check licenses, opt-outs (robots.txt AI tokens, TDM reservations) and seek advice for commercial use.

What is llms.txt? A proposal for sites to publish a Markdown file at /llms.txt listing their most useful content for language models, with links to Markdown versions of pages. See llmstxt.org.

How do I keep links and citations working? Make links absolute when converting, keep the page URL and title in metadata, add section anchors to chunks, and store the fetch date.


Where to go next


Repository layout

firecrawl-alternatives/
├── llmscrape/
│   ├── robots.py      # robots.txt with caching and RFC 9309 error handling
│   ├── fetch.py       # polite fetcher: UA, rate limits, retries, size cap
│   ├── extract.py     # boilerplate removal, main content, HTML -> Markdown
│   ├── clean.py       # tracking parameter removal, repeated-line cleanup
│   ├── sitemap.py     # sitemap and sitemap index parsing
│   ├── crawl.py       # same-site BFS crawler, URL normalization
│   ├── chunk.py       # heading-aware chunking
│   └── __main__.py    # CLI: python3 -m llmscrape URL [--crawl] [--jsonl] [--out DIR]
└── tests/
    ├── fixtures/      # sample HTML pages
    └── test_llmscrape.py  # 17 tests incl. a local HTTP server with robots.txt

Contributing

PRs are welcome: new tools (with repository link and license), recipes you have run, better extraction heuristics with a fixture and a test, and corrections when projects change. Please keep entries accurate and neutral, keep llmscrape standard-library only, and run python3 -m unittest discover -s tests before submitting. Contributions that help evade bot protection will not be accepted.

License

Code and guide are released under the MIT License.

If this helped you, a star helps others find it.

More free resources

Part of the Ralpberry Labs open-source collection. See also Top 100 Open Source.