[qutebrowser] Extend ad blocking to allow single URL blocking.

Jay Kamat jaygkamat at gmail.com
Sat Nov 3 18:24:24 CET 2018

Viacheslav Chimishuk writes:

>> 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/

FWIW, (as The-Compiler already said) the existing URL match patterns should
work in this way too. I think these would be the translations of the examples:


I definitely agree that we should only have one match pattern, unless we are
adopting some other format, like ABP or uBlock. I'm not sure if there's a
single standard for block lists though, it looks like even ABP and uBlock have
slightly different standards. From a quick look, it looks like they are more
complicated than just blocking urls, they also have support for hiding
individual elements on a page.

> 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.

FWIW, my reviews are (in general) worse than The-Compiler's reviews, as after
my reviews are done, he usually catches some important things I missed.
Because of that, I try to avoid actually merging things unless other people
have also reviewed and tested it (which hasn't happened too much).

There are a couple areas (such as tab sizing and pinned tabs) which I would
feel comfortable with managing, but The-Compiler still has a much better
overall picture of everything :).

More information about the qutebrowser mailing list