Registry / data / resiliparse

resiliparse

JSON →
library1.0.7pypypi✓ verified 87d ago

Resiliparse is a collection of robust and fast processing tools for parsing and analyzing web archive data, encompassing utilities for character encoding, HTML parsing, content extraction, and process guarding. It is currently at version 0.16.0 and is actively maintained as part of the ChatNoir web analytics toolkit.

pip install resiliparse
INSTALL
IMPORT
SIG · RESILIPARSE
R
resiliparse
datapythonv1.0.7
Install
2.4s avg
Import
15ms
Disk
60MB
Pass rate
4/ 10
Env Coverage4 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.7 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✓ 2.45s
py 3.11
✕ build_error
✓ 2.6s
py 3.12
✕ build_error
✓ 2.08s
py 3.13
✕ build_error
✓ 2.38s
py 3.9
✕ build_error
✕ build_error
60MB installed
● package 60MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

HTMLTree
from resiliparse.parse.html import HTMLTree
detect_encoding
from resiliparse.parse.encoding import detect_encoding
bytes_to_str
from resiliparse.parse.encoding import bytes_to_str
extract_plain_text
from resiliparse.extract.html2text import extract_plain_text

This quickstart demonstrates parsing HTML from both Unicode strings and byte strings with encoding detection, and then performing basic DOM selection to extract information.

from resiliparse.parse.html import HTMLTree from resiliparse.parse.encoding import detect_encoding, bytes_to_str html_content = """<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Example page</title> </head> <body> <main id="foo"> <p id="a">Hello <span class="bar">world</span>!</p> </main> </body> </html>""" # Parse from a Unicode string tree = HTMLTree.parse(html_content) print(f"Document title: {tree.title}") # Find an element by CSS selector paragraph = tree.query_selector('p.bar') if paragraph: print(f"First paragraph with class 'bar': {paragraph.text}") # Parse from bytes with encoding detection html_bytes = html_content.encode('utf-16') encoding = detect_encoding(html_bytes) decoded_html = bytes_to_str(html_bytes, encoding) tree_from_bytes = HTMLTree.parse(decoded_html) print(f"Title from bytes: {tree_from_bytes.title}")
Debug
Known issues
breakingDOMNode objects become invalid after any DOM tree manipulation (modification or deallocation of the parent tree). Continuing to use existing `DOMNode` instances after manipulation can lead to Python crashes or security vulnerabilities due to dangling pointers (use-after-free).
fix
Re-obtain or re-query `DOMNode` instances after any modification to the HTMLTree or its nodes. Avoid storing `DOMNode` references across modification operations.
affects: All versions up to 0.16.0
gotchaThe HTML parsing module is currently marked as experimental. While generally well-tested, it may contain upstream Lexbor bugs that are fixed but not yet released in Resiliparse. Building from the latest Lexbor Git master might offer a more stable experience.
fix
For critical applications, consider building Resiliparse binaries with the latest Lexbor Git master or be aware of potential edge-case parsing issues.
affects: All versions up to 0.16.0
gotchaWhen parsing HTML from bytes using `parse_from_bytes()`, the `encoding` parameter is a 'best guess'. Internally, Resiliparse will remap the encoding according to the WHATWG specification and use `bytes_to_str()` which attempts fallback encodings if the primary one fails.
fix
While a 'best guess' is often sufficient, be aware of the internal remapping and fallback logic. For highly critical encoding scenarios, manual pre-processing with `detect_encoding()` and `bytes_to_str()` might offer more granular control.
affects: All versions up to 0.16.0
gotchaFastWARC is a separate package and needs to be installed independently if WARC file parsing is required. It is not bundled with the main `resiliparse` package.
fix
Ensure `pip install fastwarc` is run if you plan to work with WARC archives.
affects: All versions up to 0.16.0
Errors
Common errors & fixes
ERROR: Could not build wheels for resiliparse
The Rust toolchain (Rust compiler `rustc` and `cargo`) is not installed or not configured correctly, preventing `pip` from building the necessary Rust extensions from source.
fix
Install the Rust toolchain by following the instructions on `rustup.rs`, then retry `pip install resiliparse`.
ModuleNotFoundError: No module named 'resiliparse'
The `resiliparse` package is not installed in the current Python environment or the installation failed previously.
fix
Install the package using `pip install resiliparse`.
AttributeError: module 'resiliparse' has no attribute 'html2text'
The `html2text` function is located within the `resiliparse.extract` subpackage, not directly under the top-level `resiliparse` package.
fix
Import from the correct subpackage: `from resiliparse.extract import html2text`.
TypeError: argument 'html_bytes' must be bytes, not str
A function like `resiliparse.extract.html2text` or `resiliparse.parse.html.parse_html` expects its primary HTML content argument to be a `bytes` object, but a `str` object was provided.
fix
Encode the string to bytes before passing it to the function, for example: `html_string.encode('utf-8')`.
Upgrade
Version history
1.0.7latest on PyPI · released Jun 11, 2026
Audit
Dependencies
fastwarcoptionalHigh-performance WARC parsing library, often used in conjunction with Resiliparse for web archive data.
uchardetrequiredUsed by EncodingDetector for universal character encoding detection (C wrapper).
Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources
resiliparse — pip install resiliparse · libregistry