Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/adbar/trafilatura/llms.txt

Use this file to discover all available pages before exploring further.

Trafilatura is packaged as a software library available from PyPI and runs on Linux, macOS, and Windows. The standard installation takes under a minute and gives you both the Python API and the trafilatura CLI command.

Prerequisites

Trafilatura requires Python 3.10 or higher. To check which version is available on your system, run:
python3 --version   # "python" also works on some systems
# Python 3.10.12  ← version 3.10 or higher is fine
If Python is not yet installed, see the official installation guide or the Django Girls tutorial for a beginner-friendly walkthrough.

Basic Installation

pip install trafilatura
pip downloads Trafilatura and all required dependencies automatically. After installation both import trafilatura in Python and the trafilatura CLI command are available.

Upgrading

Trafilatura is under active development. Keep it up to date to benefit from the latest improvements:
# Upgrade to the latest stable release
pip install --upgrade trafilatura

# Install the very latest code from the repository
pip install --force-reinstall -U git+https://github.com/adbar/trafilatura

Optional Extras

A handful of third-party packages extend Trafilatura’s functionality. You can install all of them at once with the [all] extra, or add individual packages as needed:
# Install every optional extra
pip install trafilatura[all]

# Install a single extra package
pip install faust-cchardet
Everything works even if not all optional packages are installed. Trafilatura detects which packages are present and automatically uses the best available combination.
Extra packageWhat it adds
brotliBrotli compression support for downloads
faust-cchardetFaster and more accurate encoding detection (especially for Asian encodings)
htmldate[speed]Faster and more precise publication-date extraction
py3langidLanguage detection on the extracted main text
pycurlFaster HTTP downloads; useful where urllib3 falls short
urllib3[socks]SOCKS proxy support for downloads
zstandardZstandard compression support for downloads

Older Python Versions

If you need to run Trafilatura on a Python version older than 3.10, install a specific older release:
pip install trafilatura==<version>
Python versionLast compatible Trafilatura release
3.6 / 3.71.12.2
3.50.9.3
3.40.8.2

Troubleshooting

CLI entry point not found

If the library installs successfully but the trafilatura command is not recognised in your terminal, the Python user-level bin directory may not be on your PATH. Linux / macOS:
export PATH="$HOME/.local/bin:$PATH"
Add this line to your shell profile (~/.bashrc, ~/.zshrc, etc.) to make it permanent. For more details, see the official Python documentation on user installations. Windows: Refer to the Stack Overflow guide on finding pip-installed executables for Windows-specific instructions.

macOS — Homebrew alternative

Installation on macOS is generally easier with Homebrew:
brew install trafilatura

Next Steps

Quickstart

Extract your first web page with Python or the CLI in under five minutes.

Introduction

Learn what Trafilatura can do and how it fits into the broader ecosystem.

Build docs developers (and LLMs) love