Qutebrowser Interceptors
By chimo on (updated on )I'm using qutebrowser as my daily-driver to browse the web. In my configs, I have interceptors to redirect "(www.)reddit.com" requests to "old.reddit.com" since I find the old interface much more usable. I wanted to add something similar for youtube, but ran into some issues.
When loading a video page on youtube (ex: youtube.com/v/<video-id>), it seems that the page doesn't have a "interceptor.ResourceType.main_frame", but instead has a "interceptor.ResourceType.preload_frame". I don't really know what any of that means, and I found out by just printing the "ResouceType" for each URL being loaded. I figured I just needed to add "preload_frame" to the list of ResourceTypes not to block.
Well at that point the browser tried to redirect but I was greeted with an error message telling me the renderer had crashed. Something very similar to the issue 5737. Maybe you're not supposed to redirect on preload_frames, I'm not sure, but I don't know what my other options would be.
I then took things into a different direction. Qutebrowser supports greasemonkey scripts. I found an existing one that is very similar to what I want to do, so I gave that a shot.
To my chagrin, it didn't seem to work. After trying a bunch of things, I realized that those scripts need JavaScript enabled in the browser (duh!). I usually have JavaScript disabled, and I turn it on/off as required. I also have a list of domains where JavaScript is permitted. So what I ended up doing is permitting JavaScript on (www.)youtube.com just so that my greasemonkey kicks-in and redirects to an Invidious instance.
So anyway, what was supposed to be a quick "add a couple of domains to a list" ended up being much more time-consuming. Which is a little funny since I use mpv to watch youtube 98% of the time anyway.