craiu / mobiletrackers

A repository of telemetry domains and URLs used by mobile location tracking, user profiling, targeted marketing and aggressive ads libraries.
GNU General Public License v3.0
166 stars 14 forks source link

Compatibility with Ad Blockers #6

Closed Nzzyme closed 8 months ago

Nzzyme commented 1 year ago

Can you please make your Master List compatible with AdGuard and other ad blockers like ublocker? Tried adding this to AdGuard but it won't filter/block the domains as the syntax for the individual rules is not in the right format.

craiu commented 1 year ago

Thanks for the report. I am not familiar with the AdGuard format, do you know by any chance why it doesn't like the list? After all it's just plaintext hostnames. Any advice would be welcome.

elliotwutingfeng commented 8 months ago

The following bash script creates lists compatible with Adblock Plus (ABP) and UBlock Origin (UBO). I use something similar for my own blocklists. The sed utility is required.

ABP requires the hostnames to be wrapped like this ||example.com^, for UBO it is ||example.com^$all.

Comment lines starting with # and blank lines are ignored.

sed -E '/(^#.*$|^$)/!s/^/\|\|/;/(^#.*$|^$)/!s/$/\^/' list.txt > list-ABP.txt
sed -E '/(^#.*$|^$)/!s/^/\|\|/;/(^#.*$|^$)/!s/$/\^$all/' list.txt > list-UBO.txt
craiu commented 8 months ago

Thanks Wu Tingfeng, added the versions processed by your script to the repo.