{"name":"python-readability: Extract Clean Main Content from HTML Documents","description":"python-readability is a fast Python port of arc90's Readability tool, designed to extract and clean the main body text and title from any given HTML document. It provides an efficient way to process web content, making it easier to focus on essential information. This library is regularly updated to match the latest readability.js functionalities, ensuring modern compatibility and performance.","github":"https://github.com/buriy/python-readability","url":"https://osrepos.com/repo/buriy-python-readability","source":"osrepos.com","sourceDescription":"This repository profile is provided by osrepos.com, an open source repository discovery platform.","repositoryProfile":"https://osrepos.com/repo/buriy-python-readability","generatedFor":"open source discovery and AI-assisted research","markdown":"https://osrepos.com/repo/buriy-python-readability.md","json":"https://osrepos.com/repo/buriy-python-readability.json","topics":["Python","Readability","Content Extraction","Web Scraping","HTML Parsing","LXML","Article Extraction","Open Source"],"keywords":["Python","Readability","Content Extraction","Web Scraping","HTML Parsing","LXML","Article Extraction","Open Source"],"stars":null,"summary":"python-readability is a fast Python port of arc90's Readability tool, designed to extract and clean the main body text and title from any given HTML document. It provides an efficient way to process web content, making it easier to focus on essential information. This library is regularly updated to match the latest readability.js functionalities, ensuring modern compatibility and performance.","content":"## Introduction\n`python-readability` is a powerful and fast Python library that allows developers to extract the main body text and title from any HTML document. It is a robust port of arc90's original Readability project, continuously updated to align with the latest `readability.js` features. This tool is invaluable for tasks requiring clean, focused content extraction from web pages, such as building RSS feeds, content aggregators, or text analysis tools.\n\n## Installation\nInstallation is straightforward using `pip` or `conda`.\n\nbash\n$ pip install readability-lxml\n\n\nAlternatively, with `conda`:\n\nbash\bash\n$ conda install -c conda-forge readability-lxml\n\n\n## Examples\nUsing `python-readability` is simple. Here's a quick example demonstrating how to fetch a web page and extract its title and summary:\n\npython\nimport requests\nfrom readability import Document\n\nresponse = requests.get('http://example.com')\ndoc = Document(response.content)\nprint(doc.title())\n# Output: 'Example Domain'\n\nprint(doc.summary())\n# Output: \"<html><body><div><body id=\\\"readabilityBody\\\">\\n<div>\\n    <h1>Example Domain</h1>\\n\\n<p>This domain is established to be used for illustrative examples in documents. You may\\nuse this\\n    domain in examples without prior coordination or asking for permission.</p>\\n\\n    <p><a href=\\\"http://www.iana.org/domains/example\\\">More information...</a></p>\\n</div>\\n\\n</body>\\n</div></body></html>\"\n\n\n## Why use it\n`python-readability` stands out for several reasons:\n*   **Speed and Efficiency:** It's a fast implementation, crucial for processing large volumes of data.\n*   **Modern Compatibility:** Regularly updated to match `readability.js`, ensuring it works well with contemporary web content.\n*   **Comprehensive Extraction:** Beyond just text, it can extract titles, handle images (including saving all images with `keep_all_images=True`), and supports CJK characters.\n*   **Python 3.x Support:** Fully compatible with a wide range of Python 3 versions (3.8 - 3.13).\n*   **Clean Output:** Replaces XHTML output with HTML5 in `summary()` calls, providing modern and cleaner HTML.\n*   **Active Development:** The change log indicates continuous improvements and bug fixes, reflecting an actively maintained project.\n\n## Links\n*   GitHub Repository: [https://github.com/buriy/python-readability](https://github.com/buriy/python-readability){:target=\"_blank\"}\n*   PyPI Package: [https://pypi.python.org/pypi/readability-lxml](https://pypi.python.org/pypi/readability-lxml){:target=\"_blank\"}","metrics":{"detailViews":11,"githubClicks":9},"dates":{"published":null,"modified":"2025-11-07T20:00:38.000Z"}}