If you use Firefox, Safari, Google Chrome or Opera, you can download YouTube videos directly by pasting the following code into your address bar while watching the video.
javascript:window.location.href = 'http://youtube.com/get_video?video_id=' + swfArgs['video_id'] + "&l=" + swfArgs['l'] + "&sk=" + swfArgs['sk'] + '&t=' + swfArgs['t'];
When the download is finished, be sure to rename it with a .flv extension.
Alternatively, use this code:
javascript:window.location.href = 'http://youtube.com/get_video?video_id=' + swfArgs['video_id'] + "&fmt=18" + "&l=" + swfArgs['l'] + "&sk=" + swfArgs['sk'] + '&t=' + swfArgs['t'];
to download in the higher quality mp4 format.
(via)