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.5.tar.gz (4.5 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.5-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for philiprehberger_url_clean-0.1.5.tar.gz
Algorithm Hash digest
SHA256 0c5cbfcafda1af451e63df0244a55009ede1dd67e5270e529f2abaa2aa4d9bbb
MD5 0403980c72e13c5cabfc8018e070adfc
BLAKE2b-256 27cf9615cd4ecd99816ddf82863372ab4c581ad352f43b997b5fa4a60adb553c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for philiprehberger_url_clean-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6e189baeb199152b6c69acfe7eedb9977b679210195a35c5ed97eaf6beccbb87
MD5 7a4674e7b6aae60ac876ab0e6e74a3ce
BLAKE2b-256 47217d02ff6ef7934e1249cf6e5832f530464f47a57371797be984f4da787e1c

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