January 22nd 2018
Install mpv on your computer.
Install youtube-dl on your computer. More about that later.
- Install the Open With addon. It seems to be available only for Mozilla browsers, but I'm pretty sure something similar also exists for chromish browsers.
Now make sure mpv is working with local files.
Regardless of this article, mpv is about the best media (video) player available for Linux.
It will automatically detect if youtube-dl is in your
$PATH, and use it to play web URLs.
So now all you have to do is to add an entry to Open With settings to open a link with mpv. Additionally, make sure it appears in the Main context Menu (links).
First let me say that youtube-dl can do much more than just download youtube videos! With the technique described in this article, I'm using it on a large number of video sites, soundcloud mixes, bandcamp playlists etc. etc.
While it might be in some distros' repositories, it is better to install & update it manually, because most media sites' API changes are addressed and fixed near-immediately, much faster than any distro developer could react.
$HOME/bin is in your
$ ln -s /path/to/youtube-dl-newest-version/youtube-dl ~/bin/
You only have to do this once.
If you are not using the github repo, you can regularly update the binary itself with
youtube-dl -U. Do this any time you get errors with downloading something, then try again.
Disclaimer: I have not tried this method because I'm using the github repo.
Any of the three tools described here are very useful by themselves.
Use youtube-dl to download videos and music for later use. You can tell it to download a specified quality, codec, create a folder structure based on metadata etc. etc.
Use Open With to open images or PDFs etc. in external applications.
Use mpv to play all sorts of stuff directly from the command line. You'll be surprised by its versatility - multiple media files are often detected automatically, so it plays them one after the other, to only mention one thing. DVDs' contents are usually interpreted correctly, so it starts playing the feature film immediately.
I could go on and on.