6
submitted 1 month ago by tdTrX@lemmy.ml to c/piracy@lemmy.ml

Title

you are viewing a single comment's thread
view the rest of the comments
[-] tdTrX@lemmy.ml 1 points 1 month ago

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$'

this post was submitted on 14 Jan 2026
6 points (100.0% liked)

Piracy

25516 readers
1 users here now

Welcome to /c/piracy

No netflix or streaming services landlubbers allowed, this is pirates territory.

founded 6 years ago
MODERATORS