Launch youtube videos in mpv with qutebrowse
mafflerbach
Posted on October 27, 2020
I am a heavy vim user, so I search for vim bindings for my browser to get a mouse-less browsing and navigation experience. Firefox and Chrome have quite good extensions, but still it was not enough for a pure mouseless experience. So after some search I stumble over qutebrowser and I became very soon my main browser.
One of the main feature of qutebrowser is, among the other things, the possibility to launch other processes or scripts via a self defined shortcut.
I configured my browser in that way, that it fills a playlist, open a playlist in mpv and open a specific video URL in mpv directly. In combination with yt-dlc I can start any youtube video via broser with mpv.
Usually you would use youtube-dl, but thanks to the DMCA takedown, we have to use a fork, which seams a better alternative because the original Repo experienced a slowdown in development.
A small disclaimer here: The youtube-dl and there forks are not Abel to download, or stream DRM protected content at all. We will have to wait what will happen to the project and there fork and if the takedown is valid.
config.bind('<Ctrl-Shift-p>', 'hint links spawn --verbose --detach /home/maren/dotfiles/i3/script/fillplaylist.sh push {hint-url}')
config.bind('<Ctrl-Shift-o>', 'spawn --verbose --detach /home/maren/dotfiles/i3/script/fillplaylist.sh play')
config.bind('<Ctrl-Shift-d>', 'hint links spawn --verbose --detach mpv {hint-url} --input-ipc-server=/tmp/mpvsocket')
To fill and start a playlist, I wrote a small helper script:
#!/bin/bash
if [ $1 == "play" ]; then
echo "play mpv"
mpv --playlist=/tmp/playlist --input-ipc-server=/tmp/mpvsocket
rm -f /tmp/playlist
fi
if [ $1 == "push" ]; then
echo $2 >> /tmp/playlist
fi
Posted on October 27, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.