Custom browser extension to play youtube videos directly in MPV
- A browser extension adds buttons on the thumbnails with a custom url (such as
vidytmpv://https://www.youtube.com/watch?v=Omy3BERUd1g). - A custom mimetype (
x-scheme-handler/vidytmpv) capturesvidytmpv://urls and is configured to point to avidytmpv-handler.desktopfile. - The
vidytmpv-handler.desktopfile calls a shell script that executes pipe-viewer with the correct youtube video url. pipe-viewerstreams the video tompv. It can be configured to launchvlcinstead.
This is currently Linux only, unless you can figure out the way to execute a script through a custom URL scheme on other OSes
Dependencies: pipe-viewer, mpv, zsh
- cd to the repo in the terminal
- make sure the scripts are executable
chmod +x ./scripts/* - install the custom url scheme handler file
cp ./scripts/vidytmpv-handler.desktop ~/.local/share/applications/ - install the mpv opener script to somewhere in your path
cp ./scripts/vidytmpv-scheme-open ~/.local/bin/, this script uses zsh, but you can change it to bash if you don't have zsh installed - add this line under
[Added Associations]:x-scheme-handler/vidytmpv=vidytmpv-handler.desktopin~/.config/mimeapps.listor your distro's equivalent - manually install the extension (tested on brave, you may need to enable developer mode)
Here it is in action, adds buttons on every thumbnail, and in the video description.