Update:
On Ubuntu a better approach to download youtube videos from command line is using clive. It has options to download the best available format for the video using the -f option.
Also a to download videos directly from the youtube.com homepage a firefox extension provides a “Save As” option just below the playing video. Here again, we have option to download from HD to the lowest available resolution of the video. Get the extension from here. http://userscripts.org/scripts/show/25105
Old method below, keeping it around for the memories.!!
Recently I found a fantastic python script do download videos from youtube.com. http://www.arrakis.es/~rggi3/youtube-dl/
You just need to pass the url of the video like this
$youtube-dl -t http://youtube.com/watch?v=LNY7Lau0sJw
Below is a script which can download the videos based on your search results on youtube.com.
Suppose you make a search as Shilpa Shetty Big Brother 😛 and you get a results page, now save this page as say results.html
Now put the below give script into a file called as youtube_download.sh and run it from the directory u saved results.html
#script to download vids from www.youtube.com
#! /bin/sh
if [ $# -lt 1 ]; then
echo "Usage: $0 filename.html |which has links from youtube.com search results"
echo "-Ajo Paul http://ajopaul.wordpress.com"
exit 1
fi
watchlink=""
for i in `cat $1 | grep "watch?" | cut -d '"' -f 2`
do
#watchlink="http://www.youtube.com"$i
if [ "$watchlink" != "$i" ]; then
echo "*********Now Downloading $i **********"
# youtube-dl -t $i 2>&1;
watchlink=$i
fi
done
echo "Done!"
echo "-Ajo Paul http://ajopaul.wordpress.com"
You can also put this script as a cronjob, but before that you must download youtube-dl and put in anywhere in your $PATH.