The past 10 years wouldn't have been possible without you. Thank you!
This is a Guest Post and does not necessarily reflect the thoughts and opinions of Techzim. We have a strong filtering process of what makes it to our blog and are confident that you’ll enjoy the article below.
This article is part of a series of guest posts by Garikai Dzoma on helping new users migrate successfully to the Ubuntu operating system. Garikai started using Ubuntu Linux in 2007 and is an active member of the Zimbabwe Ubuntu LoCo team.
One of the good things about the good old Firefox 3 was that when in Ubuntu flash videos were downloaded to the /tmp directory. All you had to do was wait for the buffering to complete, minimize the Firefox window, got to the /tmp directory and copy and paste the video into the folder of your choosing. Playing the video is easy enough; vlc plays pretty much any format from .mp4 to .flv.
Imagine my shock when I visited YouTube using Firefox 4 for the first time and could not find anything in the /tmp folder. After a lot of digging I found that the new browser uses a per user cache which is in the ~/.firefox directory. After I spend 10 minutes exploring the tree I could still not find the video file and fuming I decided to Google it. And then I met youtube-dl: the pedigree python based YouTube downloader.
I am aware that youtube-dl is in the repositories. However the upstream version is significantly up-to-date when compared with the version in the repositories. So the examples below are on the upstream version. If you want the easy way out just type the command:
- sudo apt-get install youtube-dl
This is a command line program which works on all platforms including Windows and yet it is an amazing 103KB. To get youtube-dl:
- Visit the download page http://rg3.github.com/youtube-dl/download.html in your browser and right click on the download link and select save as youtube-dl or
- Alternatively you can open the terminal and type the command:
wget –tries=0 https://raw.github.com/rg3/youtube-dl/2011.03.29/youtube-dl
The first method saves the youtube-dl file in the ~/Downloads folder whilst the second method saves the youtube-dl file in the current directory most likely in the /home/user directory where user is the name of the current user. Preparing youtube-dl If you used the first method i.e. the browser method please open the terminal and type the command:
- cd ~/Downloads/
This will take you to the directory where youtube-dl is i.e. this becomes the current directory. The following commands now apply to both method 1 and 2. Please note if you used method 2 above i.e. you used wget you should skip the cd ~/Downloads/ command above and follow the following commands.
- sudo chmod a+x youtube-dl
- sudo cp youtube-dl /usr/local/bin/
- To download a video just open a terminal and type youtube-dl http://video.url where video.url is the web address of the video. For example youtube-dl http://www.youtube.com/watch?v=jYvkpYM2jpc this downloads a video to show you one of the reasons I love Ubuntu over Windows.
- The above command downloads the video into the current directory usually /home/usr. Open nautilus/dolphin or some other file manager and visit your home directory to copy the videos where you want them. You can use the pwd command to find the current directory in case it is not your home directory.
- Videos can be played using vlc/xine/totem/mplayer or any comatible video player of your choice. This works with other video sites too not just YouTube.
- Please check for regular updates. Whenever there is an update follow this guide from step 1 or 2 but before step 5 type the command:
- Videos can be converted using ffmpeg.( I will be write a guide on this but the command man ffmpeg should give you a place to start.) ffmpeg can also extract audio from videos and convert them into mp3s.) I must add that ffmpeg is a command line program also but several gui front ends exist.
This makes the file executable.
This copies the youtube-dl file to the /usr/local/ directory where all locally installed and compiled programs are stored. This makes sure that the youtube-dl program is in everyone’s PATH i.e. any user on your system can now just type youtube-dl to access the program. Tip: In the command line you can save time by just typing yout and pressing the Tab key so the shell can autocomplete/expand the name.
sudo rm -f youtube-dl
Quick NetOne, Telecel, Africom, And Econet Airtime Recharge
If anything goes wrong, click here to enter your query.