trafilatura-rs
A Rust port of trafilatura's extraction.
- Exact. Output is byte-identical to trafilatura 1.11.0 or 2.3.1, whichever is installed.
- Fast. Text extraction takes 8 to 11 times less CPU.
- Drop-in. It patches trafilatura in place, and any call it doesn't cover runs Python trafilatura unchanged.
Installation
pip install "trafilatura-rs[trafilatura]" # trafilatura 1.11.0
pip install "trafilatura-rs[trafilatura2]" # trafilatura 2.3.1
The extras pin the versions trafilatura-rs is checked against:
| Package | [trafilatura] |
[trafilatura2] |
|---|---|---|
| trafilatura | 1.11.0 | 2.3.1 |
| lxml | 6.1.3 | 6.1.3 |
| htmldate (metadata) | 1.11.0 | 1.11.0 or newer, via trafilatura 2.3.1 |
Wheels are built for Linux (glibc and musl, x86_64 and aarch64), macOS (x86_64 and arm64) and Windows (x64 and arm64), for Python 3.10+, with libxml2 statically linked.
Quickstart
Run existing code unchanged:
TRAFILATURA_RS=1 python my_script.py # or: python -m trafilatura_rs my_script.py
Or in code:
import trafilatura_rs
trafilatura_rs.install() # patches trafilatura, including copies imported earlier
from trafilatura_rs import extract # or import the drop-in directly; same signature
The patch also reaches calls made inside other libraries, such as datatrove's Trafilatura step (see also
datatrove-rs), and trafilatura's command line.
trafilatura_rs.supports(**kwargs) reports whether an extract call runs in Rust. supports_bare_extraction,
supports_baseline, supports_html2txt, supports_extract_metadata and supports_find_date do the same for the
other functions. trafilatura_rs.engine() returns the trafilatura version being reproduced.
Coverage
Runs in Rust:
extract()on str or bytes, or on an lxml tree with trafilatura 2.3.1.- Output formats: txt, markdown, json, xml, html and csv.
- Options: metadata, comments, links, images,
favor_precision,favor_recall,no_fallback/fast,include_tables,deduplicate,url,options=Extractor(...), config files, blacklists,prune_xpathanddate_extraction_params. target_language: txt and json only. It uses a port of py3langid's classifier; close calls, where float32 rounding could change the result, go to Python.
bare_extraction(), including links, images anddeduplicate.- Other functions:
html2txt,baseline,extract_metadataand htmldate'sfind_date. - Metadata: title, author, date, sitename, categories, tags, license and JSON-LD. Dates use a port of htmldate, including the dateutil and dateparser calls it makes; rare date strings go to Python.
- trafilatura's command line.
Runs Python trafilatura:
target_languagewith other output formats, or with links or images.- lxml trees with trafilatura 1.11.0, which modifies the caller's tree, and any other input that isn't str, bytes or an lxml tree.
- 2.3.1's
deduplicatewith a caller-suppliedLRUCache. - Metadata on Python 3.10.
- Every call when the installed versions don't match (see Exactness).
With deduplicate=True, calls that run in Python share trafilatura-rs's deduplication cache, so output depends on
earlier pages exactly as it does in trafilatura. The verified configurations per output and function are listed in
docs/coverage.md.
Exactness
Every covered configuration is checked page by page against trafilatura 1.11.0 and 2.3.1 on 10,666 Common Crawl pages, comparing the final output and per-stage tree hashes. Any difference is treated as a bug. The parser matches too: trafilatura-rs statically links libxml2 2.14.6, the version lxml 6.1.3 bundles, with the same parsing options (PATCHES.md). Documents the port declines inside a covered call rerun in Python.
Version guards keep results exact when other package versions are installed:
| Guard | Accepts | Otherwise |
|---|---|---|
REPRODUCES |
trafilatura 1.11.0 or 2.3.1 with lxml 6.0.0 to 6.1.3 | every call runs Python; install() warns and patches nothing |
REPRODUCES_METADATA |
htmldate 1.11.0 | metadata calls and find_date run Python |
REPRODUCES_DATES |
dateparser 1.5.0, python-dateutil 4.0.0 | htmldate's dateparser and dateutil calls run Python |
The guards are in trafilatura_rs._versions. REPRODUCES accepts every lxml 6.0.x and 6.1.x release, because
trafilatura's output under each one equals its output under 6.1.3 on the full corpus. Metadata also needs Python
3.11+. Differences between the two trafilatura versions are documented in
docs/trafilatura-2x-diff.md and
docs/trafilatura-23-diff.md.
Speed
CPU time per page, Python trafilatura divided by trafilatura-rs, single thread. Times, instruction counts and machine load are in docs/benchmarks.md and the linked pull requests.
| Call | 1.11.0 | 2.3.1 | Pages | Source |
|---|---|---|---|---|
datatrove's call (favor_precision, deduplicate, no comments) |
11.0x | 8.3x | 10,666 | benchmarks |
extract(html) |
8.8x | 8.5x | 10,666 | benchmarks |
extract(tree), lxml HtmlElement |
Python | 9.7x | 10,562 | #17 |
output_format="markdown" |
8.5x | 12.9x | 3,000 | #7 |
output_format xml, html, csv (no comments) |
9.9-10.4x | 8.4-9.2x | 3,000 | #13 |
include_links / include_images |
7.2-9.8x | 7.4-8.4x | 3,000 | #13 |
command line (bytes, options=Extractor()) |
8.2x | 9.5x | 3,000 | #7 |
with_metadata=True, url=... (no comments) |
4.7x | 4.9x | 3,000 | #16 |
| json with metadata (no comments), balanced / precision | 5.4x / 6.0x | 4.4x / 6.9x | 3,000 | #16 |
deduplicate with metadata, txt (precision) and xml |
7.1-7.5x | 7.1-7.2x | 3,000 | benchmarks |
bare_extraction, links (with images and metadata) |
6.2-6.4x | 6.4-7.0x | 3,000 | benchmarks |
bare_extraction, deduplicate: precision / with metadata |
8.2x / 5.9x | 7.3x / 6.5x | 3,000 | benchmarks |
bare_extraction, each focus, with and without comments |
6.8-10.1x | 6.2-8.0x | 10,666 | #10 |
bare_extraction with metadata and url |
2.4-3.2x | 3.0-3.6x | 10,666 | #10 |
html2txt / baseline |
2.2x | 4.2-4.3x | 10,666 | #10 |
extract_metadata, with and without default_url |
1.6-1.7x | 1.9-2.0x | 10,666 | #10 |
htmldate.find_date, with and without url |
2.0-2.6x | 2.0-2.6x | 10,666 | #10 |
The 3,000-page runs count pages that rerun in Python against trafilatura-rs. The bare_extraction runs from #10 leave
out the 29 to 74 such pages per configuration.
Related projects
rs-trafilatura is a separate project: an independent extractor inspired by trafilatura, not a port. With datatrove's call, its output equals trafilatura 1.11.0's on 171 of the 10,666 pages.
Contributing
Development setup, the parity harness, benchmarks and releasing are covered in CONTRIBUTING.md.
License
Apache-2.0, like trafilatura. The vendored libxml2 is MIT-licensed, and win-iconv (Windows builds) is public domain. trafilatura-rs is an independent project and is not affiliated with the trafilatura authors.
Metadata
Release files for trafilatura-rs 0.1.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| trafilatura_rs-0.1.12.tar.gz | 3.0 MB | With provenance | Details for trafilatura_rs-0.1.12.tar.gz |
Built distributions (wheels)
Total release size: 27.8 MB
Release files / trafilatura_rs-0.1.12.tar.gz
| Download URL | trafilatura_rs-0.1.12.tar.gz |
|---|---|
| Size | 3.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1f775d3839b452ec74da00ed3d2c3b0f0cada44dffab0698e0d0871497d2fe5e
|
|
BLAKE2b-256 checksum How to use checksums |
6907767c922bdfd48ba9fa1fe0490bcda38891a4c6c4b4f7bcf953d410bc4618
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.
Transparency logRelease files / trafilatura_rs-0.1.12-cp310-abi3-win_arm64.whl
| Download URL | trafilatura_rs-0.1.12-cp310-abi3-win_arm64.whl |
|---|---|
| Size | 3.1 MB |
| Tags | CPython 3.10 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
75d8f4494b8e4d6617f71a9a9d8b401525ae6e82ce0c1dd0af3fb99962bb91c6
|
|
BLAKE2b-256 checksum How to use checksums |
40f2ba21079448e58bf61eb330bbb87d8a831f115f8a20e73e974b29f00634de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.
Transparency logRelease files / trafilatura_rs-0.1.12-cp310-abi3-win_amd64.whl
| Download URL | trafilatura_rs-0.1.12-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 3.3 MB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
d411bfcaae997a4e9cd0a6acb71dbd06200a5a7d2733bd4e142b40f997379120
|
|
BLAKE2b-256 checksum How to use checksums |
135e46ef8b606616e08f9b4959ef392d565dfbdd5cb7d9b31ce4aa2d5debde9d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.
Transparency logRelease files / trafilatura_rs-0.1.12-cp310-abi3-musllinux_1_2_x86_64.whl
| Download URL | trafilatura_rs-0.1.12-cp310-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 3.3 MB |
| Tags | CPython 3.10 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
5d1f88c242c46f9fecc49da11d42ebdd972f099b1260c26a3473804cdfdc1247
|
|
BLAKE2b-256 checksum How to use checksums |
61ff661f616b4458ba48091c699e7d42ba607739f9a9e6641436051134a42078
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.
Transparency logRelease files / trafilatura_rs-0.1.12-cp310-abi3-musllinux_1_2_aarch64.whl
| Download URL | trafilatura_rs-0.1.12-cp310-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 3.1 MB |
| Tags | CPython 3.10 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
7b5cf178a4ad4c2cc2ced41e37a79d602098c9caca504f5654056e5ec37d3989
|
|
BLAKE2b-256 checksum How to use checksums |
5f914203b307ce85699777722ed28c571ef5451592cdc144183e96c275642027
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.
Transparency logRelease files / trafilatura_rs-0.1.12-cp310-abi3-manylinux_2_28_x86_64.whl
| Download URL | trafilatura_rs-0.1.12-cp310-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 3.1 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
088f11e6eda7d478ba4895fc2f12f5cb71f5838d2b2c0f0f64efc6f37cbccfa0
|
|
BLAKE2b-256 checksum How to use checksums |
470cd3efe9d7390432f2c92843a1564886d0a5dd6905cb2d0eaba676ca58c38c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.
Transparency logRelease files / trafilatura_rs-0.1.12-cp310-abi3-manylinux_2_28_aarch64.whl
| Download URL | trafilatura_rs-0.1.12-cp310-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 3.0 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
b5ca0e592cbecc74b79596814a6a428a1eff7cd352d047a556c19e2c57f57d2c
|
|
BLAKE2b-256 checksum How to use checksums |
7028c14464bef07e0f03a4005b7111bb11d8432f8032bea585f799fc4ef207ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.
Transparency logRelease files / trafilatura_rs-0.1.12-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | trafilatura_rs-0.1.12-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.9 MB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
bfd30b9a7fdc6df38b9c4799e67621a26a3447f6d08714571ac4c6c9be88c04e
|
|
BLAKE2b-256 checksum How to use checksums |
40340f0860d7686cabd15ecd81b905d3b9da0d3681c5246885839c752fcb2a7d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.
Transparency logRelease files / trafilatura_rs-0.1.12-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | trafilatura_rs-0.1.12-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 3.0 MB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
13059261fed4fc65413b60a6586e8f9d60abbd7c9c6b19e00694ad24ed435edc
|
|
BLAKE2b-256 checksum How to use checksums |
f36a73466f36a9e95de4016bccdb3269c344da66df32804488b94c041595c6a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.
Transparency logSecurity for trafilatura-rs 0.1.12
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 9 files in this release have been uploaded with provenance metadata.
Attestation for trafilatura_rs-0.1.12.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.