Dear linux geeks,
In this article I will introduce you to a nice and useful command-line tool that can be used to play and download youtube videos from the terminal.
The tool is called pms-youtube. It allows you to search and play music directly from youtube as well as download your favourite tracks. I have used youtube-dl as my video downloader tool, but I am starting to like pms-youtube because I can play my favourite clips or movies directly from the command-line before deciding to download them or not.
pms-youtube has the following features:
– Search and play audio/video.
– Create local playlists.
– Download audio/video.
– Works with Python 2.7 and 3.x.
– Works with Windows, Linux and Mac OS X.
– Requires mplayer.
The installation of this youtube video downloader is a very easy two step process which requires to install the pip python package management tool since it is written in python programming language.
Open a new terminal (CTRL+ALT+T) and install pip with the following command.
sudo apt-get install pip
Then run the following command to install the pms-youtube tool in your machine.
sudo pip install pms-youtube
How does it work?
The pms-youtube tool is based on pms terminal based program to search, stream and download music. The pafy library is used to handle interfacing with YouTube.
Mplayer is required for streaming the files so you have to make sure it is installed in your machine. You can install it with the following command.
sudo apt-get install mplayer
How to use pms-youtube for downloading audio and video?
It is very easy to download music from youtube with the pms-youtube tool as there are no long and complex commands to type in the terminal. You launch the tool with the pmsyt command and then start searching for your favourite movie clip or song with one of the following syntax rules.
As you can see searches must be prefixed with either a . or / character. For example if I want to search for Pitbull music clips I have to type the following command.
The following screenshot shows the search results.
Note: Make sure to launch the tool with pmsyt before performing a search.
Do you like to stream some music? Type the number you want to play and hit Enter.
The music will start to play but you are not going to watch any video clip yet because by default pms-youtube will play or download the audio file.
Use the following command to be able to watch or download the video file.
set show_video True
This what i get after enabling the show_video.
As you guys can see the video is playing on Mplayer. Use 9 or 0 to play with the volume, space to pause the video and q to return back.
How about downloading the video? Ok guys, it is very easy. Hit q to return back and then type the following command to start the download.
d number_you _want
You will get information about Bytes received, Rate and remained time for the video to download. Now you know how to play and download music with the pms-youtube tool, but if you like to learn more options type help and hit Enter.