# Url cleaning notes

**URL:** https://discourse.imfreedom.org/t/url-cleaning-notes/413
**Category:** General
**Tags:** development
**Created:** [August 18, 2026, 3:41am UTC](https://discourse.imfreedom.org/t/url-cleaning-notes/413 "2026-08-18T03:41:32Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![grim](https://discourse.imfreedom.org/user_avatar/discourse.imfreedom.org/grim/32/4_2.png) [@grim](https://discourse.imfreedom.org/u/grim)
#### Post date: [August 18, 2026, 3:41am UTC](https://discourse.imfreedom.org/t/url-cleaning-notes/413/1 "2026-08-18T03:41:32Z")

</div>

I started looking into how to develop a “link cleaning” feature and it’s a lot more complicated than I originally anticipated.

Firefox has two different lists, one licensed under the [LGPL](https://github.com/mozilla/firefox-dev/blob/main/toolkit/components/antitracking/StripOnShareLists/LGPL/StripOnShareLGPL.json) and the other under the [MPL2](https://github.com/mozilla/firefox-dev/blob/main/toolkit/components/antitracking/StripOnShareLists/MPL2/StripOnShare.json) but they have variations so we’d need to load both.

Brave uses a [single file](https://github.com/brave/adblock-lists/blob/master/brave-lists/clean-urls.json), licensed under MPL2, which is fine for us, that uses a regex syntax. Their algorithm appears to check the url against all patterns, skipping ones that make the exclude pattern, and then remove the specified params.

We will probably use the brave file as the source as it’s just easier to work with it.

Overall, right now I’m leaning towards a separate library for this and only this as url cleanup is something useful to a lot of applications, so having all of the other stuff from birb from example would be a bit much. Also this needs to load a bunch of data at startup and have a way to tear it down at shutdown and birb doesn’t have that right now.

I’m thinking we’ll just commit the file directly to the repo, maintaining the license as it will be unedited, then adding it to a resource that will be loaded at startup via an `init` method and freed via a `uninit` method. This would require json-glib and glib but that should be all that is necessary.

Later on, we can add support for removing tracking parameters. Brave has some good [documentation](https://github.com/brave/brave-browser/wiki/Query-String-Filter) on that as well.

---

<div class="post-metadata">

### Author: ![clokep](https://discourse.imfreedom.org/user_avatar/discourse.imfreedom.org/clokep/32/31_2.png) [@clokep](https://discourse.imfreedom.org/u/clokep)
#### Post date: [August 18, 2026, 1:30pm UTC](https://discourse.imfreedom.org/t/url-cleaning-notes/413/2 "2026-08-18T13:30:56Z")

</div>

Looking through those it seems like the lists were originally all sourced from outside sources.

I assume the Firefox list is separated in two due to sourcing the original data, although [⚙ D203080 Bug 1859353 - Part 1: Added more query params in LGPL license specific file.r=pbz](https://phabricator.services.mozilla.com/D203080) doesn’t say too much besides someone checked w/ Mozilla legal. The bug itself mentions [GitHub - Smile4ever/Neat-URL: Neat URL cleans URLs, removing parameters such as Google Analytics' utm parameters. · GitHub](https://github.com/Smile4ever/Neat-URL) but unsure if that’s actually the source.

Brave’s seems like a derivative of AdGuard’s list: [Initial clean-urls.json list · brave/adblock-lists@b4bc704 · GitHub](https://github.com/brave/adblock-lists/commit/b4bc7044bc626d2d90d89c04726a62b6440faf70)

* * *

Both LGPL-2.0 and MPL-2.0 should be compatible with GPL-2.0 so any/all of them are acceptable.

The rest of the plan seems reasonable, minus that you’ll likely want to keep the file in sync periodically. (This points to not wanting to modify it and using it directly as you mention!)

---

<div class="post-metadata">

### Author: ![grim](https://discourse.imfreedom.org/user_avatar/discourse.imfreedom.org/grim/32/4_2.png) [@grim](https://discourse.imfreedom.org/u/grim)
#### Post date: [August 18, 2026, 5:51pm UTC](https://discourse.imfreedom.org/t/url-cleaning-notes/413/3 "2026-08-18T17:51:04Z")

</div>

Thanks for the additional information!
