Jump to content

Link Clean — Remove extraneous information from URLs

Recommended Posts


Remove UTM parameters, mobile subdomains, and other clutter from URLs via the Universal Action.


Alternatively, configure the Hotkey to clean a selected URL or use the lc keyword to declutter the last copied URL.


Redirects are followed before cleaning and the result is pasted to the frontmost app.

⤓ Install on the Alfred Gallery | Source


Edited by vitor
Link to comment
  • 3 weeks later...
  • 2 months later...
  • 3 months later...
  • 1 month later...



Generalize to remove everything after ?. I used to only do that case-by-case since there are legitimate uses for ? that change the page without being useless, but it seems like that maybe the minority. Trying it this way and maybe will add exceptions instead. Please let me know if any links break with this new rule.

To update, download the latest version (same URL) or wait a few days (15 or less) and it’ll prompt you to on next usage, since it uses OneUpdater.

Link to comment
  • 5 weeks later...
  • vitor changed the title to LinkClean — Remove extraneous information from URLs

I just installed it. On amazon.com works great, but on Amazon.de not so good, this is before and after (yes - they are the same):





Link to comment
  • 1 year later...



Added Universal Action, Hotkey, and External Trigger. Also, when getting a URL from the clipboard, it now gets the most recent one (text starting with http) from your clipboard history.

To update, download the latest version (same URL) or wait a few days and it’ll prompt you to on next usage, since it uses OneUpdater.

Link to comment
  • 11 months later...
31 minutes ago, heyJoeCampbell said:

That page can be accessed without an account.


Not for me. I can never access Facebook and Instagram links.


Either way, the problem is the URL itself has characters which shouldn’t be there. This version takes care of that.

Link to comment
  • 1 month later...

Hi @vitor, it seems like the workflow has trouble processing URLs with special characters. In the following example, the letter "ê":




[09:04:45.245] ERROR: LinkClean[Run Script] /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/uri/rfc3986_parser.rb:21:in `split': URI must be ascii only "https://www.amazon.com.br/Ame\u0302ndoa-Crua-Sem-Casca-Naturais/dp/B0B8K34Q6T/ref=sr_1_3?keywords=ame\u0302ndoas&qid=1683633872&sprefix=ame\u0302ndoas,aps,257&sr=8-3" (URI::InvalidURIError)
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/uri/rfc3986_parser.rb:73:in `parse'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/uri/common.rb:234:in `parse'
	from ~/Documents/Alfred Backup/Alfred.alfredpreferences/workflows/user.workflow.85C674D2-59BA-4C72-9F72-558B7E243773/linkclean_functions.rb:14:in `clean_url'
	from ~/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/81F8F0A2-2B58-4E6A-A27F-C29BF057A1B6:3:in `<main>'


Link to comment
  • vitor changed the title to Link Clean — Remove extraneous information from URLs

Hi @vitor, getting an error on the following link:




[18:23:32.167] ERROR: Link Clean[Run Script] /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/open3.rb:213:in `spawn': no implicit conversion of nil into String (TypeError)
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/open3.rb:213:in `popen_run'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/open3.rb:159:in `popen2'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/open3.rb:342:in `capture2'
	from ~/Documents/Alfred Backup/Alfred.alfredpreferences/workflows/user.workflow.85C674D2-59BA-4C72-9F72-558B7E243773/linkclean_functions.rb:7:in `follow_redirects'
	from ~/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/24729476-AB52-40DA-B4D6-492C2ED02142:3:in `<main>'


Link to comment

I can’t reproduce the error. Are you on version 2023.1 of the workflow? If so, what’s your Alfred and macOS versions? And how are you invoking the workflow (please give precise steps so I can try to reproduce).

Link to comment

Doh, just realized I configured the hotkey to use the Selection in MacOS, rather than the clipboard (and I hadn't selected anything) 🤦‍♂️


Sorry about that!

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...