Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Sanitizr is a lightweight, open-source tool that cleans and simplifies URLs by stripping tracking parameters, removing redirects, and protecting your privacy — all from the terminal. Fast. Scalable. Tracker-free.

License

Jordonh18/sanitizr

Repository files navigation

Sanitizr - URL Cleaner

Python Tests License: GPL-3.0 PyPI cover GitHub last commit

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.

About

Sanitizr is a lightweight, open-source tool that cleans and simplifies URLs by stripping tracking parameters, removing redirects, and protecting your privacy — all from the terminal. Fast. Scalable. Tracker-free.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published