Skip to content

Instantly share code, notes, and snippets.

@konfou konfou/README.md
Last active Sep 20, 2017

Embed
What would you like to do?
play-with-mpv youtube-dl compatible sites

The following files have been adapted from ViewTube userscript 'protocol' [1] instructions. But I find no reason using such a complex script just for opening a video to mpv, so instead I opted out to using a bookmarklet. The files may be installed as follows:

user$ mkdir -p $HOME/.local/{bin,share/applications}
user$ cp notube.desktop $HOME/.local/share/applications/notube.desktop
user$ install -D -m 755 notube.sh $HOME/.local/bin/notube.sh
user$ xdg-mime default notube.desktop x-scheme-handler/notube

After that, make a new bookmark naming it e.g. Play with MPV and set location to the body of notube.js. From there, on a supported from youtube-dl site click the bookmarklet.

Firefox users need to perform some additional steps. Goto about:config, make a new boolean type key named network.protocol-handler.expose.notube and set its value to false. Then associate the protocol using the following link:

>tfw the botnet wants me to starve

In case the url isn't working open this and click it there.

On another note, Firefox users don't even have to open the page and instead they can goto to the (as it is obvious from the bookmark) url notube:<url> replacing <url> of course with the site url or even a direct link to a video or audio.

[Desktop Entry]
Name=ViewTube
Exec=/home/user/.local/bin/notube.sh %u
Type=Application
Terminal=false
MimeType=x-scheme-handler/notube
/* web browser bookmarklet */
javascript:location.href='notube:'+location.href
#!/bin/bash
#todo: allow external audio and sub files
#todo: play from/until a given time position
mpv "$(echo "$@" | sed "s/notube://")"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.