Download videos from youtube.com

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 :P 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.


2 Responses to “Download videos from youtube.com”

  1. I use http://www.savetube.com to save any youtube videos. They also got a latest saved section.

  2. Ajo Paul says:

    But ofcourse you can download only one vid a time :) . The idea above was to be able to download all videos from search pages(with links) on youtube.com. Say u search for Lab puppies, save the page and give it to the script using the above code, u wud get all the vids listed on the page! :) :)

Leave a Reply