Skip to main content

Remove tracking parameters from URLs

Project description

philiprehberger-url-clean

Tests PyPI version License

Remove tracking parameters from URLs.

Installation

pip install philiprehberger-url-clean

Usage

from philiprehberger_url_clean import clean, remove_params, normalize

# Remove tracking params (utm_*, fbclid, gclid, etc.)
clean("https://example.com/page?utm_source=twitter&id=123")
# "https://example.com/page?id=123"

# Remove specific params
remove_params("https://example.com?a=1&b=2&c=3", ["b", "c"])
# "https://example.com?a=1"

# Normalize URL
normalize("HTTPS://Example.COM/path/../page?b=2&a=1")
# "https://example.com/page?a=1&b=2"

# Batch processing
clean_many(["https://example.com?utm_source=x", ...])

API

  • clean(url, extra_params=None) — Remove known tracking parameters
  • remove_params(url, params) — Remove specific parameters
  • normalize(url) — Lowercase host, sort params, resolve path
  • clean_many(urls, extra_params=None) — Batch clean

Development

pip install -e .
python -m pytest tests/ -v

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

philiprehberger_url_clean-0.1.4.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

philiprehberger_url_clean-0.1.4-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file philiprehberger_url_clean-0.1.4.tar.gz.

File metadata

File hashes

Hashes for philiprehberger_url_clean-0.1.4.tar.gz
Algorithm Hash digest
SHA256 35a670afa5cef2eaac3486c584efbcc1a765e0db44f9dc5dd69f0b1986b01d97
MD5 cd5e05c2596955f924348c224fc3da06
BLAKE2b-256 91cd1bb3e271c32c87a4b98abd27d7c721d86e88ad21d7059818a383ec512014

See more details on using hashes here.

File details

Details for the file philiprehberger_url_clean-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for philiprehberger_url_clean-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 dc17f37d076cae131cfd1fedfe93a601123221d8f1efcf4442a6dfc08352fd15
MD5 358c3dc8c06673509ce762f20d840661
BLAKE2b-256 6ed3cd4ccf46cdbeaedd71ea2e168e2015290de2328da51f94ff6fd1c426cfc6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page