I can see ublock uses regexp for its list. Implementing regexp support we can reuse their files, which will get us a huge benefit. Unfortunately their format is not compatible with UrlPattern we use and looks much more complicated than a simple regexp. IMHO, it is better to start with simple substring match for now.
https://github.com/gorhill/uBlock/wiki/Static-filter-syntax On 02.11.2018 20:28, Viacheslav Chimishuk <vchimis...@yandex.ru> wrote: > > How would the line to block Youtube ads look like? > > > > FWIW I'm against introducing another URL pattern format, and I'd rather > > use the existing URL pattern class which is also used for ":set -u" > > (aka "per-domain settings"). See: > > https://github.com/qutebrowser/qutebrowser/issues/4188 > > I was thinking more about simple substring matching, which is much > faster then regular expressions we use for options. And should be > enough for blocking. For example, I banned Youtube ads with next > simple code. > > u = url.toDisplayString() > if 'youtube.com/get_midroll_' in u: > return True > > I propose to treat `~` prefix as a substring instead of domain > name. For example, next file parses to substrings list. > > $ cat ads-blocked.txt > ~youtube.com/get_midroll_ > ~youtube.com/csi_204 > evil-site.com > ~.google.com/pagead/ > > As you can see, you can mix it with regular domain names. This allows > user to maintain its own list or comunity can create and support such > file and serve it from GitHub or qutebrowser.org. > As a part of this change it would be great to support `file://` > protocol in `content.host_blocking.lists` list, so user can serve the > file from the disk without running web-server (if it is not > implemented already, haven't checked it). > > > > Note that I'm busy with university work on qutebrowser at least until > > christmas, so my time to look at PRs is quite limited currently: > > https://lists.schokokeks.org/pipermail/qutebrowser-announce/2018-September/000051.html > > https://lists.schokokeks.org/pipermail/qutebrowser-announce/2018-October/000053.html > > Yeah... Maybe other people can help you with that and accept PRs? :) I > can see Jay Kamat is very active in the project. In this case QB can > progress and grow faster. > > -- > Best regards, Viacheslav Chimishuk > vchimis...@yandex.ru > Ukraine, Khmelnitsky -- Best regards, Viacheslav Chimishuk vchimis...@yandex.ru Ukraine, Khmelnitsky