Jump to content

Link Clean — Remove extraneous information from URLs


Recommended Posts

Usage


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


ua.png


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


lc.png


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...

Update.

 

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):

 

https://www.amazon.de/Nintendo-Switch-Konsole-Grau-2019/dp/B07W13KJZC?pf_rd_r=KZPSC02CKA27F12JWRPM&pf_rd_p=f6c987c2-74e9-4cb4-ac98-788b2ab13bdc&pd_rd_r=30ee7e3a-fde1-434b-b587-0c4b66921954&pd_rd_w=hn1Oq&pd_rd_wg=MLD3x&ref_=pd_gw_crs_zg_bs_300992

 

https://www.amazon.de/Nintendo-Switch-Konsole-Grau-2019/dp/B07W13KJZC?pf_rd_r=KZPSC02CKA27F12JWRPM&pf_rd_p=f6c987c2-74e9-4cb4-ac98-788b2ab13bdc&pd_rd_r=30ee7e3a-fde1-434b-b587-0c4b66921954&pd_rd_w=hn1Oq&pd_rd_wg=MLD3x&ref_=pd_gw_crs_zg_bs_300992

Link to comment
  • 1 year later...

Update.

 

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 "ê":

 

https://www.amazon.com.br/Amêndoa-Crua-Sem-Casca-Naturais/dp/B0B8K34Q6T/ref=sr_1_3?keywords=amêndoas&qid=1683633872&sprefix=amêndoas,aps,257&sr=8-3

 

[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:

 

https://produto.mercadolivre.com.br/MLB-1526997661-garrafas-de-dispensador-de-sabo-montagem-da-parede-rodada-_JM?matt_tool=14372353&matt_word=&matt_source=google&matt_campaign_id=14302215552&matt_ad_group_id=134553706028&matt_match_type=&matt_network=g&matt_device=c&matt_creative=539425529212&matt_keyword=&matt_ad_position=&matt_ad_type=pla&matt_merchant_id=145336421&matt_product_id=MLB1526997661&matt_product_partition_id=1816389384366&matt_target_id=aud-2009166904988:pla-1816389384366

 

[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...