Skip to main content

clean-url

Clean tracking parameters and other junk from URLs.

clean-url is a command-line tool for cleaning URLs.

I have text expansion macros that insert the URLs from my frontmost browser window, and this tool cleans up the URL before insertion. It removes tracking and referral parameters, unwanted URL suffixes, and generally de-junks URLs.

Installation

You need Rust installed; I recommend using Rustup. Then clone this repository and compile the code:

$ git clone "git://alexwlchan.net/projects/clean-url.git"
$ cd clean-url
$ cargo install --path .

Usage

clean-url takes a single argument: the URL to be cleaned. For example:

$ clean-url "https://www.etsy.com/uk/listing/689034321/pride-flag-planets-complete-set-cross?ls=s&ga_order=most_relevant&ga_search_type=all&ga_view_type=gallery&ga_search_query=mathysphere+pride+planets&ref=sr_gallery-1-3&dd=1&content_source=750fbda2-0f23-409a-b29d-9714dc4e0ba3%253ALTcadfd6ad1b51d9f2c43bf9fc61aa37ee3ee5cc68&organic_search_click=1&logging_key=750fbda2-0f23-409a-b29d-9714dc4e0ba3%3ALTcadfd6ad1b51d9f2c43bf9fc61aa37ee3ee5cc68"
https://www.etsy.com/uk/listing/689034321/pride-flag-planets-complete-set-cross⏎

Note: output is printed without a trailing new line, so it integrates cleanly with my text expansion macros.

License

This project is shared under the MIT license.