From 228099ac193bfa4fe60351599796a8fc4601e173 Mon Sep 17 00:00:00 2001 From: Phantop Date: Sun, 19 Jul 2020 23:17:36 -0400 Subject: [PATCH] Qute: config.py for YouTube ad block --- .config/qutebrowser/config.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .config/qutebrowser/config.py diff --git a/.config/qutebrowser/config.py b/.config/qutebrowser/config.py new file mode 100644 index 0000000..ad20aae --- /dev/null +++ b/.config/qutebrowser/config.py @@ -0,0 +1,15 @@ +config.load_autoconfig() + +from qutebrowser.api import interceptor + +# Youtube adblock +def filter_yt(info: interceptor.Request): + """Block the given request if necessary.""" + url = info.request_url + if (url.host() == 'www.youtube.com' and + url.path() == '/get_video_info' and + '&adformat=' in url.query()): + info.block() + + +interceptor.register(filter_yt)