How extraction works ==================== .. meta:: :description lang=en: How Trafilatura extracts main content from HTML: cleaning, rule-based extraction, readability/jusText fallbacks, and boilerplate removal pipeline. This page gives a high-level view of what happens when you call ``extract()``. Understanding the pipeline helps when tuning settings or diagnosing unexpected output. Pipeline at a glance -------------------- .. code-block:: text Input HTML │ ▼ 1. Cleaning ─────────── strip scripts, styles, unwanted elements │ ▼ 2. Main extraction ──── rule-based content detection │ ├─ enough text? ──→ done │ ▼ 3. Fallback cascade ─── readability + jusText (skipped in fast mode) │ ├─ enough text? ──→ done │ ▼ 4. Baseline rescue ──── broad text extraction on the original tree │ ├─ enough text? ──→ done │ ▼ 5. Recall escalation ── re-run stages 1–3 with relaxed thresholds │ ▼ Output text + metadata Stages ------ Cleaning ^^^^^^^^ Before extraction begins, the HTML tree is simplified: - Elements like ``