YousList icon indicating copy to clipboard operation
YousList copied to clipboard

[feature]: Generate the hosts file from the Adblock file

Open T145 opened this issue 2 years ago • 3 comments

The 1Blocker rules are generated from the Adblock file using generate_rules.py: would it be possible to generate the hosts file in a similar way?

T145 avatar Apr 21 '23 23:04 T145

That's possible, but the result will be erroneous because script doesn't know whether it's okay to block the whole domain.

For example, there are some rules starting with youtube.com:

||youtube.com/get_midroll_info^
||youtube.com/get_video_info?*el=adunit
||youtube.com/youtubei/v1/player/ad_break^

Then the script will generate youtube.com in the hosts.txt. Maybe generating only $third-party rules can be effective. Unfortunately, current YousList hasn't been precise for $third-party.

yous avatar Apr 22 '23 08:04 yous

Instead of making hosts.txt a proper hostsfile, generate a file that has the raw domains and filter out domains that are contained in separate whitelist file, like whitelist.txt.

T145 avatar Apr 22 '23 19:04 T145

https://github.com/FiltersHeroes/ScriptsPlayground/blob/master/Readme_SFLB.md

@HOSTSinclude section_file_name - converts direct blocking rules of section/filterlist into the hosts format and include it into the final filterlist file (converting is always done on temporary files).

Only I won't help you if you are stuck at the stage of running this on your computer or repository after through the github/gitlab/CircleCi action.

The script has excluded filter with path processing per domain block action, so it should not block access to YouTube.

I can't promise that if you find a bug I will know how to fix it.

krystian3w avatar May 26 '23 13:05 krystian3w