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

Viacheslav Chimishuk vchimishuk at yandex.ru
Fri Nov 2 19:28:30 CET 2018

> 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

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
vchimishuk at yandex.ru
Ukraine, Khmelnitsky

More information about the qutebrowser mailing list