Trafilatura
$ trafilatura Community Low Risktrafilatura 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.
pip install trafilatura Strips web boilerplate into clean Markdown or JSON locally in milliseconds without burning LLM tokens on raw HTML.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
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
Read-only extraction by default; only writes locally if -o output directory is explicitly supplied.
- Stdout-first extraction; opt-in
-odisk writes
Pure/standard Python wheel distributed via PyPI and uvx across macOS, Linux, and Windows.
- Easy install via
pip install trafilaturaoruvx trafilatura
Benchmarked industry-grade boilerplate removal with --precision/--recall tuning, deduplication, and sitemap/feed crawling.
- High-accuracy article extraction,
--precision, and--sitemap
Actively maintained by Adrien Barbaresi (adbar/trafilatura) and relicensed to Apache-2.0.
- Active
adbar/trafilaturarepository under Apache-2.0
Dedicated ReadTheDocs CLI guide covering every flag, format, and batch workflow.
- Detailed CLI docs at
trafilatura.readthedocs.io
Security, Auth & Guardrails
Requires no credentials; fetches public URLs or reads HTML from stdin/local files.
Free, Apache-2.0 open-source Python CLI.
# 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
trafilatura -u https://example.com --markdown
Downloads the page, removes nav/footer boilerplate, and prints clean Markdown to stdout.
trafilatura -u https://example.com --json --with-metadata
Outputs extracted body text alongside title, author, date, and URL in JSON.
Controlled Writes & Previews
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
--markdownor--jsonwithout 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.
- !
--crawlwithout bounds can fetch many pages on large sites.