Sanitizr - URL Cleaner
A powerful and modular URL cleaning library and CLI tool that removes tracking parameters and decodes redirects.
Features
- 🧹 Clean URLs by removing tracking parameters
- 🔄 Decode redirect URLs (Google, Facebook, etc.)
- ⚙️ Customizable parameter whitelisting/blacklisting
- 🧰 Supports both Python API and CLI usage
- 📋 Process URLs from clipboard, files, or standard input
- 🔧 Configurable via JSON or YAML files
Installation
You can install Sanitizr from PyPI:
pip install sanitizr
For development setup:
pip install -e ".[dev]"
Quick Start
Command Line
# Clean a single URL
sanitizr -u "https://example.com?id=123&utm_source=newsletter"
# Clean URLs from a file
sanitizr -i urls.txt -o cleaned_urls.txt
# Clean URLs from stdin
cat urls.txt | sanitizr > cleaned_urls.txt
# Use verbose output to see the changes
sanitizr -u "https://example.com?id=123&utm_source=newsletter" -v
Python API
from sanitizr.sanitizr import URLCleaner
cleaner = URLCleaner()
clean_url = cleaner.clean_url("https://example.com?id=123&utm_source=newsletter")
print(clean_url) # https://example.com?id=123
Configuration
Sanitizr can be configured via JSON or YAML files:
# config.yaml
tracking_params:
- custom_tracker
- another_tracker
redirect_params:
custom.com:
- redirect
- goto
whitelist_params:
- keep_this_param
blacklist_params:
- remove_this_param
Use the configuration with the --config option:
sanitizr -u "https://example.com?id=123&custom_tracker=abc" --config config.yaml
License
Sanitizr is licensed under the GNU General Public License v3.0 or later - see the LICENSE file for details.
Metadata
Release files for sanitizr 1.0.1
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 | Actions |
|---|---|---|---|---|
| sanitizr-1.0.1.tar.gz | 28.2 kB | Without provenance | Details for sanitizr-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sanitizr-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for sanitizr-1.0.1-py3-none-any.whl |
Total release size: 51.1 kB
Release files / sanitizr-1.0.1.tar.gz
| Download URL | sanitizr-1.0.1.tar.gz |
|---|---|
| Size | 28.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2e115e7894d510a307e5d29ec5d0eba01bc3e113e93579cf8de91108c632a685
|
|
BLAKE2b-256 checksum How to use checksums |
273c716b5ba45265bc7db1ac5abe66d9361d6c36209f47c50dc32f519b3bdfbf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / sanitizr-1.0.1-py3-none-any.whl
| Download URL | sanitizr-1.0.1-py3-none-any.whl |
|---|---|
| Size | 22.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
daf85ae7f7b1f02d98dadd758ae8c0f1c88c2a3c3d4a77500ffaa2b86e9f6137
|
|
BLAKE2b-256 checksum How to use checksums |
e70493767b2e13f7ed09fef4f99bd458de937bcb52aa733688d9f528ada63db5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Security for sanitizr 1.0.1
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.