If you ever find yourself stuck with a slow Internet connection or capped bandwidth and a YouTube video you just want to watch again and again, then downloading the YouTube video is tempting. Well good news, now you can!
The software is called youtube-dl and runs from the command line. Unfortunately, the version found in the Ubuntu Karmic (and previous) repositories is out-of-date and broken due to modifications to the YouTube API.
But despair not, the issue is fixed in the most recent release of youtube-dl. Better yet youtube-dl consists of a single Python script and is easy to install from source. Here's how.
First make sure you have Python and Mercurial installed. Open a terminal and type
sudo aptitude install mercurial python
Also make sure that the outdated version of youtube-dl is removed if previously installed.
sudo aptitude remove youtube-dl
Now fetch the youtube-dl source from the web.
hg clone http://bitbucket.org/rg3/youtube-dl/
Enter the source directory
and copy the Python script to a location where the system can find it
sudo cp youtube-dl /usr/local/bin/
And that's it!
In order to download a video from YouTube you must start watching the video on www.youtube.com. Then copy the URL of the video to the clipboard and type in a terminal
where url-on-youtube-dot-com is the URL you copied from YouTube. The video should now start downloading. The downloaded video will be in Flash Video format (.flv) and can be viewed using e.g. vlc.