Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

Trafilatura

$ trafilatura Community Low Risk
Adrien Barbaresi · Browser & Web · Apache-2.0 · macos / linux / windows

trafilatura is a lightweight Python CLI and library built for high-precision main-text extraction from web pages and local HTML files, stripping boilerplate navigation, ads, and footers. It supports --markdown, --json (--output-format json), sitemap discovery, and stdin pipelines.

FCRS-1.0 Score
88 /100
Good
Medium Confidence
Zero-Friction Install
pip install trafilatura
CLI vs MCP Decision CLI Preferred vs MCP

Strips web boilerplate into clean Markdown or JSON locally in milliseconds without burning LLM tokens on raw HTML.

Agent-Readiness Checklist

✓ JSON Output
— Field Filtering
✓ Non-Interactive
— Dry-Run
— Read-Only Mode
— NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 22 / 25

Supports --json (--output-format json), --markdown, stdin HTML piping, and silent stdout output ideal for LLM/agent ingestion.

  • Flags --json, --markdown, --with-metadata, and stdin support
Trust & Safety 22 / 25

Read-only extraction by default; only writes locally if -o output directory is explicitly supplied.

  • Stdout-first extraction; opt-in -o disk writes
Setup & Portability 13 / 15

Pure/standard Python wheel distributed via PyPI and uvx across macOS, Linux, and Windows.

  • Easy install via pip install trafilatura or uvx trafilatura
Utility & Efficiency 14 / 15

Benchmarked industry-grade boilerplate removal with --precision/--recall tuning, deduplication, and sitemap/feed crawling.

  • High-accuracy article extraction, --precision, and --sitemap
Maintenance & Lineage 8 / 10

Actively maintained by Adrien Barbaresi (adbar/trafilatura) and relicensed to Apache-2.0.

  • Active adbar/trafilatura repository under Apache-2.0
Docs & Verifiability 9 / 10

Dedicated ReadTheDocs CLI guide covering every flag, format, and batch workflow.

  • Detailed CLI docs at trafilatura.readthedocs.io

Security, Auth & Guardrails

Auth Modes
No Auth
Credential Storage

Requires no credentials; fetches public URLs or reads HTML from stdin/local files.

Side Effects
Read-Only Local Write
Cost & Quotas

Free, Apache-2.0 open-source Python CLI.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# Trafilatura Agent Rules
- Prefer `--markdown` or `--json` for concise, token-efficient stdout extraction.
- Pipe local HTML via stdin (`cat page.html | trafilatura --markdown`) when avoiding extra network requests.
- Scope `--crawl` or `--sitemap` runs with explicit output directories.

Agent-Ready Command Recipes

Safe Read-Only Queries

Extract clean Markdown from a URL
trafilatura -u https://example.com --markdown

Downloads the page, removes nav/footer boilerplate, and prints clean Markdown to stdout.

Extract structured JSON with metadata
trafilatura -u https://example.com --json --with-metadata

Outputs extracted body text alongside title, author, date, and URL in JSON.

Controlled Writes & Previews

Crawl a small sitemap subset to a local directory
trafilatura --sitemap https://example.com --output-format json -o ./extracted

Discovers URLs from sitemap.xml and writes extracted JSON files under ./extracted.

Strengths for Agents

  • + Turns noisy HTML pages into clean --markdown or --json without needing a headless browser.
  • + Works seamlessly on stdin HTML or remote URLs.

Caveats & Pitfalls

  • ! Does not execute client-side JavaScript; SPAs require pre-rendering via a headless browser first.
  • ! --crawl without bounds can fetch many pages on large sites.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI