html-scrubber
html-scrubber is a simple Python library built with BeautifulSoup that allows you to clean HTML content by removing unwanted tags such as styles, scripts, iframes, and more. It's ideal for web scraping, data extraction, or sanitizing HTML content before further processing.
Features
- Clean HTML content by removing unnecessary elements
- Supports removal of
<style>,<script>,<iframe>,<svg>,<meta>, and<noscript>tags - Easily extendable with custom tags to remove
- Option to return the cleaned HTML as a BeautifulSoup object or a plain string
Installation
To install html-scrubber, you can use pip:
pip install html-scrubber
Usage
Here is an example of how to use the html-scrubber library to clean HTML content:
from html_scrubber import clean_html
raw_html = """
<html>
<head><style>body {color: red;}</style></head>
<body>
<script>alert("test");</script>
<div>Test content</div>
<iframe src="https://example.com"></iframe>
</body>
</html>
"""
# Clean the HTML content by removing style, script, and iframe tags
cleaned_html = clean_html(
html_content=raw_html,
remove_styles=True,
remove_scripts=True,
remove_iframes=True,
return_as_string=True,
)
Metadata
Release files for html-scrubber 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| html_scrubber-0.0.3.tar.gz | 3.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| html_scrubber-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.7 kB
Release files / html_scrubber-0.0.3.tar.gz
| Download URL | html_scrubber-0.0.3.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
46d86d8e097765efce557a6c8d16127c193e6546309467dd9504096036221c07
|
|
BLAKE2b-256 checksum How to use checksums |
c310a2b98ee547739af32a241bcfcb5bb424a80d32b978db9525f80b26f61e57
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Release files / html_scrubber-0.0.3-py3-none-any.whl
| Download URL | html_scrubber-0.0.3-py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
10064da695f495a3945c700bddb6570329a3ffdcef55aefd698d49805bf7348f
|
|
BLAKE2b-256 checksum How to use checksums |
cf211d0b1129014640382c1c83ea98446965932036b4078dfe576b255136ea1f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Security for html-scrubber 0.0.3
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.