How to run copied links via uBlock Origin to clean them?
from tdTrX@lemmy.ml to piracy@lemmy.ml on 14 Jan 2026 15:43
https://lemmy.ml/post/41682152

Title

#piracy

threaded - newest

[deleted] on 14 Jan 2026 19:35 next collapse

.

tdTrX@lemmy.ml on 15 Jan 2026 06:55 collapse

Doing a good job of that is complicated, maybe too much so for ublock origin. Besides stripping off junk parameters, you have to bypass redirects, unquote parameters and recursively clean up anything that looks like a url, and do a bunch of site specific rewriting. Here’s the regex I use just for crap parameters:

ref_src and ref_url are used by twitter. Actually (at end) we

kill anything that ends with ‘id’ since that yet caused any probs.

junk_regexp = r’gclid$|gclsrc$|fbclid$|aff$|msclkid$|[uhi]tm_.|hmb_.’ +
‘|ref_src$|ref_url$|pr_.|spm(_.)?|(pos|sid|ss)$|cvid$’ +
'|kx$|variant$|mc.id$|ad_id$|cm_mmc$|sara_ecid$|guce
.*’ +
‘|.campaign(id)?$|adsetid$|_cf_chl_f_tk$|cm_sp$’ +
'|…*id$|trk
.
|gs_lcrp$’ if base.endswith(‘.php’): junk_regexp += ‘|s$’