Skip to main content

trafilatura-rs

PyPI Python versions CI License

A Rust port of trafilatura's extraction that returns the same output, byte for byte, as trafilatura 1.11.0 or 2.3.1, using 8 to 11 times less CPU for text extraction.

CPU per page with datatrove's call: trafilatura 1.11.0 15.77 ms, trafilatura-rs 1.44 ms; trafilatura 2.3.1 13.72 ms, trafilatura-rs 1.65 ms; rs-trafilatura 0.1.1 11.07 ms

Install

pip install "trafilatura-rs[trafilatura]"    # trafilatura 1.11.0
pip install "trafilatura-rs[trafilatura2]"   # trafilatura 2.3.1

trafilatura-rs reproduces whichever of the two is installed. The extras pin the versions it 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

htmldate 1.11.0 and trafilatura 2.3.1 require lxml 6.1.3 or newer, so the extras install 6.1.3. Metadata runs in Rust with htmldate 1.11.0 only (see Exactness). Wheels are built for Linux (glibc and musl, x86_64 and aarch64), macOS (x86_64 and arm64) and Windows (x64 and arm64), 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

Calls trafilatura-rs covers run in Rust; every other call runs Python trafilatura as before. That includes calls made inside other libraries, such as datatrove's Trafilatura step (or use datatrove-rs), and trafilatura's command line.

trafilatura_rs.supports(**kwargs) says 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.

What runs in Rust

  • extract() on str or bytes, with output_format txt, markdown, json, xml, html or csv, with or without metadata, comments, include_links and include_images, and the usual options (favor_precision, favor_recall, no_fallback/fast, include_tables, deduplicate, url, options=Extractor(...), config files, blacklists, prune_xpath, date_extraction_params)
  • metadata: title, author, date (a port of htmldate's find_date, with native ports of the dateutil and dateparser calls it makes; rare strings go to Python), sitename, categories, tags, license, JSON-LD
  • html2txt, baseline, extract_metadata, bare_extraction and htmldate's find_date
  • trafilatura's command line, which calls extract with bytes

Python trafilatura still runs:

  • target_language
  • with_metadata=True together with deduplicate=True
  • bare_extraction with include_links, include_images or deduplicate
  • lxml trees and other non-str/bytes input
  • 2.3.1's deduplicate given a scoped LRUCache
  • prune_xpath expressions that select anything but elements
  • every call when the installed versions don't match (see below)

Which configurations each output is verified for, and the details per function: 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 output matches because the parser does: 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.

Three version guards keep results exact when other packages are installed:

Guard Pins When the installed version differs
REPRODUCES (trafilatura, lxml) pairs: 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 (trafilatura_rs._versions) dateparser 1.5.0, python-dateutil 4.0.0 the native date parsers are off; htmldate's dateparser and dateutil calls run in Python

trafilatura's output under each lxml 6.0.x and 6.1.x release equals its output under 6.1.3 on the full corpus, which is why REPRODUCES accepts them. Metadata also needs Python 3.11+. The differences between the two trafilatura versions: docs/trafilatura-2x-diff.md, docs/trafilatura-23-diff.md.

rs-trafilatura is a different project: an independent extractor inspired by trafilatura rather than a port. With datatrove's call its output equals trafilatura 1.11.0's on 171 of the 10,666 pages.

Speed

CPU time per page, Python trafilatura divided by trafilatura-rs, single thread. The first two rows are fresh runs on the full corpus, median of 3 (docs/benchmarks.md has the times, instruction counts and machine load). The other rows are the results recorded in the pull request that added them.

Call 1.11.0 2.3.1 Pages Source
datatrove's call: favor_precision=True, include_comments=False, deduplicate=True 11.0x 8.3x 10,666 benchmarks
extract(html) 8.8x 8.5x 10,666 benchmarks
output_format="markdown" 8.5x 12.9x 3,000 #7
command line (bytes, options=Extractor()) 8.2x 9.5x 3,000 #7
with_metadata=True, url=... 2.6x 3.5x 3,000 #7
output_format="json", with_metadata=True, include_comments=False 3.5x 4.2x 3,000 #14
output_format xml, html, csv (include_comments=False) 9.9–10.4x 8.4–9.2x 3,000 #13
include_links / include_images, without metadata 7.2–9.8x 7.4–8.4x 3,000 #13
bare_extraction(html), each focus, with and without comments 6.8–10.1x 6.2–8.0x 10,666 #10
bare_extraction(html, with_metadata=True, url=...) 2.4–3.2x 3.0–3.6x 10,666 #10
html2txt(html) / baseline(html) 2.2x 4.2–4.3x 10,666 #10
extract_metadata(html), with and without default_url 1.6–1.7x 1.9–2.0x 10,666 #10
htmldate.find_date(html), with and without url 2.0–2.6x 2.0–2.6x 10,666 #10

The bare_extraction speedups leave out the 29 to 74 pages per configuration that rerun in Python.

Contributing

Development setup, the parity harness, benchmarks and releasing: CONTRIBUTING.md.

License

Apache-2.0, like trafilatura. Vendored libxml2 is MIT-licensed; 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.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for trafilatura-rs 0.1.10
File Size Uploaded Provenance Actions
trafilatura_rs-0.1.10.tar.gz 3.0 MB With provenance Details for trafilatura_rs-0.1.10.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for trafilatura-rs 0.1.10
File Actions
trafilatura_rs-0.1.10-cp310-abi3-win_arm64.whl CPython 3.10 abi3 Windows ARM64 Details for trafilatura_rs-0.1.10-cp310-abi3-win_arm64.whl
trafilatura_rs-0.1.10-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for trafilatura_rs-0.1.10-cp310-abi3-win_amd64.whl
trafilatura_rs-0.1.10-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details for trafilatura_rs-0.1.10-cp310-abi3-musllinux_1_2_x86_64.whl
trafilatura_rs-0.1.10-cp310-abi3-musllinux_1_2_aarch64.whl CPython 3.10 abi3 Linux musl 1.2+ ARM64 Details for trafilatura_rs-0.1.10-cp310-abi3-musllinux_1_2_aarch64.whl
trafilatura_rs-0.1.10-cp310-abi3-manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64 Details for trafilatura_rs-0.1.10-cp310-abi3-manylinux_2_28_x86_64.whl
trafilatura_rs-0.1.10-cp310-abi3-manylinux_2_28_aarch64.whl CPython 3.10 abi3 Linux glibc 2.28+ ARM64 Details for trafilatura_rs-0.1.10-cp310-abi3-manylinux_2_28_aarch64.whl
trafilatura_rs-0.1.10-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for trafilatura_rs-0.1.10-cp310-abi3-macosx_11_0_arm64.whl
trafilatura_rs-0.1.10-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for trafilatura_rs-0.1.10-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 27.3 MB

Release files / trafilatura_rs-0.1.10.tar.gz

Download URL trafilatura_rs-0.1.10.tar.gz
Size 3.0 MB
Tags Source
SHA-256 checksum
How to use checksums
517d7f968bbd91e97cebc5829dd9155ed382bb7435007e7c24722316e10636e5
BLAKE2b-256 checksum
How to use checksums
5b03a927b23521ee98a4afc7581c67fd92d468d98b70ffd1c0e8e6625f1532df
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 13, 2026.

Transparency log

Release files / trafilatura_rs-0.1.10-cp310-abi3-win_arm64.whl

Download URL trafilatura_rs-0.1.10-cp310-abi3-win_arm64.whl
Size 3.0 MB
Tags CPython 3.10 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
5623f5796a8a2b09ea7b692780d438bf7fc1fb7e516da74e6515e15dcaf435d5
BLAKE2b-256 checksum
How to use checksums
2d937ba0a48eb9c993f7bc4308db8ef655b6f9a69cc210f9b6490a9659fd98ef
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 13, 2026.

Transparency log

Release files / trafilatura_rs-0.1.10-cp310-abi3-win_amd64.whl

Download URL trafilatura_rs-0.1.10-cp310-abi3-win_amd64.whl
Size 3.2 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
e430f79d8a99d7a95af63a1c812723cfb60ecf51fb3148814b3ce6ad8c5a0475
BLAKE2b-256 checksum
How to use checksums
412d1eb9f2095b459f69c16b247ed7de3399aa85a7d85bfd4716b63b022851b2
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 13, 2026.

Transparency log

Release files / trafilatura_rs-0.1.10-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL trafilatura_rs-0.1.10-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
2e534dabf8e2c1be375df42d210a9cc9ebbd92799e4825c9b7351a05aaa3eeef
BLAKE2b-256 checksum
How to use checksums
390c62d877e965a4b6425b6e02ee2658a1c25dee41ac792e5e6072d74fa4ce35
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 13, 2026.

Transparency log

Release files / trafilatura_rs-0.1.10-cp310-abi3-musllinux_1_2_aarch64.whl

Download URL trafilatura_rs-0.1.10-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
8086ad19fdacacace43ad9ce1f5055f2fb724b72202b5e77d6757eacbe2d8b5f
BLAKE2b-256 checksum
How to use checksums
3a4d5986488f53d97b76a018fc212d7857200ac53a409747de8ba4ad7f59580e
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 13, 2026.

Transparency log

Release files / trafilatura_rs-0.1.10-cp310-abi3-manylinux_2_28_x86_64.whl

Download URL trafilatura_rs-0.1.10-cp310-abi3-manylinux_2_28_x86_64.whl
Size 3.0 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
a2d574c10990d52900a9e611078ace3b5572d8874928348420c2140f3d8b04ca
BLAKE2b-256 checksum
How to use checksums
952c8854b20c4b1cf8fe6dec56c90a6d75e0659fa66a1431217a16e5c709f296
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 13, 2026.

Transparency log

Release files / trafilatura_rs-0.1.10-cp310-abi3-manylinux_2_28_aarch64.whl

Download URL trafilatura_rs-0.1.10-cp310-abi3-manylinux_2_28_aarch64.whl
Size 2.9 MB
Tags CPython 3.10 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
27ed6caf0fa9a09cf2670c0a723150342c6fd4f34284a812b6fcbfdf41515522
BLAKE2b-256 checksum
How to use checksums
33b96d4c2766a82143aed87894c0b09a5a60f968c7524d7cf097cdd4490142cd
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 13, 2026.

Transparency log

Release files / trafilatura_rs-0.1.10-cp310-abi3-macosx_11_0_arm64.whl

Download URL trafilatura_rs-0.1.10-cp310-abi3-macosx_11_0_arm64.whl
Size 2.8 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
fed641621efc33721b85ce5c5dcfc8a66cd179cac913883ab409c0488cd1f5d6
BLAKE2b-256 checksum
How to use checksums
9945819499c7bb87d2cfeddc680ffd7e53d7533e8842602406d5a6531fdb05ed
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 13, 2026.

Transparency log

Release files / trafilatura_rs-0.1.10-cp310-abi3-macosx_10_12_x86_64.whl

Download URL trafilatura_rs-0.1.10-cp310-abi3-macosx_10_12_x86_64.whl
Size 2.9 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
66727d126c1d2f6f7cf9deec89989910ae90022ab484c65afc38d84a72e2d78d
BLAKE2b-256 checksum
How to use checksums
74ebd89eef7a3293ddb3279d3a1ae1e9a1a092f4e9a9d2a581b7657f88004310
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 13, 2026.

Transparency log

Security for trafilatura-rs 0.1.10

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.

Select from 9 files

Attestation for trafilatura_rs-0.1.10.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 13, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page