ReadabiliPy is a Python library that provides a wrapper for Mozilla's Readability.js, a powerful tool for extracting the main content from HTML pages. It also includes pure Python article extraction routines. The library augments the Readability.js output to include plain text representations of article paragraphs. The current version is 0.3.0, and it has an active development status, with updates released periodically.
pip install readabilipyVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `readabilipy` to extract article content from an HTML string. It shows both the `use_readability=True` option (which leverages Mozilla's Readability.js via Node.js if available) and the `use_readability=False` option (for the pure Python implementation). Note that the results may differ between the two methods.
Install Node.js (v14+) from nodejs.org or ensure it's in your system's PATH. If Node.js is not an option, set `use_readability=False` to explicitly use the Python-only extractor.
Always explicitly set `use_readability=True` or `use_readability=False` based on your desired behavior and ensure Node.js is correctly installed if you intend to use the Readability.js wrapper.
Upgrade to `readabilipy` v0.3.0 or newer. Ensure your input HTML is correctly encoded, preferably UTF-8.
Upgrade to `readabilipy` v0.3.0 or newer, which includes a fix for this working directory bug. If upgrading is not possible, ensure your application does not change the current working directory while `readabilipy` is processing HTML.
pip install readabilipy
Run `playwright install` in your terminal to download the necessary browser binaries.
Ensure the URL string is a complete and valid URL, including the protocol (e.g., `https://www.example.com/article`).
Provide the raw HTML content as a string (or bytes) to the `html` parameter of `readabilipy.extract_from_html`.