Skip to main content

HTML Content Extractor

This Python package provides a function to extract the "main content" from HTML documents.

Relevancy is determined by an algorithm that favors the deepest parent with the most h1, h2, h3 and p tags.

Installation

You can install this package via pip:

$ pip install html-content-extractor

Usage

from html_content_extractor import extract_content

>>> html = "<div><h1>An HTML Page</h1><p>This is some HTML content.</p></div>"
>>> content = extract_content(html, format='plaintext')
>>> print(content)
"An HTML Page\n\nThis is some HTML content."

>>> markdown = extract_content(html, format='markdown')
>>> print(content)
"# An HTML Page\n\nThis is some HTML content."

Release files for html-content-extractor 0.0.3

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

Source distribution (sdist)

Source distribution for html-content-extractor 0.0.3
File Size Uploaded
html_content_extractor-0.0.3.tar.gz 8.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for html-content-extractor 0.0.3
File Interpreter ABI Platform
html_content_extractor-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 20.6 kB

Release files / html_content_extractor-0.0.3.tar.gz

Download URL html_content_extractor-0.0.3.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1f31a04a293a0600ed06753399f3267d488ecc24cad6f06e328189901bef9821
BLAKE2b-256 checksum
How to use checksums
fc29ffbe2ae1024a72a1599e0b050390cfb04518c03c61ca229221279d829d6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release files / html_content_extractor-0.0.3-py3-none-any.whl

Download URL html_content_extractor-0.0.3-py3-none-any.whl
Size 12.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9ced23f77bdf0e8d6917415a5a03c505ead700f55cc7bf1e801525fa293fdc84
BLAKE2b-256 checksum
How to use checksums
736c8039dec5861af227c12468769cd80082566d4c3f1deb99f586ce360cb654
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

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