youtube-dl is probably the most popular command line YouTube (and not only) downloader for Linux but there's a new tool that tries to do things a bit differently.
mps-youtube is a new tool which, besides being able to download YouTube videos (either the whole video or just the audio), can also search and play YouTube videos and create local playlists, all from the command line.
By default, this is basically a YouTube audio player (and downloader), but you can enable (external) video playback from its options.
By default, this is basically a YouTube audio player (and downloader), but you can enable (external) video playback from its options.
The tool uses mplayer for streaming but it can also use mpv, a relatively new mplayer fork.
Update: the tool was initially called "pms-youtube" but that was quite an unfortunate name :) so the tool was renamed to mps-youtube.
Installation
Debian update: mps-youtube is now available in Debian unstable thanks to Zlatan Todoric: mps-youtube so install it using:
sudo apt-get install mps-youtube
For Ubuntu, see below.
1. mps-youtube can be installed using pip. To Install pip (Python3 version) in Ubuntu, use the following command:
sudo apt-get install python3-pip
2. Then install mps-youtube using pip:
sudo pip3 install mps-youtube
3. You'll also need mplayer, which you can install using the following command:
sudo apt-get install mplayer
Later on, if you want to upgrade mps-youtube, use this command:
sudo pip3 install mps-youtube --upgrade
Arch Linux users can install mps-youtube via AUR.
If you want to use this with MPV, you can install it in Ubuntu (Saucy and Trusty) by using THIS PPA.
mpsyt is also available for Windows and Mac OS X. See its GitHub page for installation instructions.
Usage
To run mps-youtube, use the following command:
mpsyt
To search for a video on YouTube, prefix your search with either "." or "/".
Example: to search for "pantera", use:
.pantera
Then, to play an item from the search results, enter its number. You can also use combinations, for instance use "1,2,3" to play items 1, 2 and 3, or "1-5" to play items 1 to 5. You can also use "shuffle" or "repeat" along with the track numbers, for example "shuffle 1-4".
To download an item, use:
d ITEM-NUMBER
for example, to download the 3rd search result, use "d 3".By default, mps-youtube will only play (and download) the audio. To view (and optionally to download) the video instead, use this command:
set show_video true
By default, the tool uses mpv if found and if it's not installed, it uses mplayer. If you want to switch to mplayer, use this commands:
set player mplayer
To switch to mpv, use these commands:
set player mpv
You can find out all the available commands by simply entering "h":
Note: More documentation is available
at https://github.com/np1/mps-youtube
Searching
You can enter a search term to search whenever the program is
expecting text input. Searches must be prefixed with either
a . or / character.
When a list of items is displayed, you can use the following
commands:
Downloading
d 3 to download item 3
Selecting Items
all to play all
1 2 3 to play items 1 2 and 3
2-4 6 7-3 to play items 2 3 4 6 7 6 5 4 3
3-6 9-12 shuffle to play selected items in random order
3-6 9-12 repeat to play selected items continuously
Manipulating Items
rm 1 3 to remove items 1 and 3. Also use rm 1 2 5-7 to
remove a range
rm all to remove all items
sw 1 3 to swap the position of items 1 and 3
mv 1 3 to move items 1 to position 3
Playlist commands
add 1 2 5-7 to add items 1 2 5 6 and 7 to the current playlist.
add 1 2 3 <playlist_name> to add items 1,2,3 to a saved
playlist. A new playlist will be created if the given name
doesn't already exist.
vp to view the current playlist (then use rm, mv and sw to
modify it)
ls to list your saved playlists
open <playlist_name or ID> to open a saved playlist as
the current playlist
view <playlist name or ID> to view a playlist (leaves
current playlist intact)
play <playlist name or ID> to play a saved playlist
directly
save or save <playlist_name> to save the currently
displayed items as a stored playlist on disk
mv <old_name or ID> <new_name> to rename a playlist
rmp <playlist_name or ID> to delete a playlist from disk
q to quit