Download Youtube videos using “Wget”
Posted by hisitech on December 7, 2007
Here there is an easy way to download Youtube videos using wget. of course you can do it by some handy Firefox extensions but as i said before do NOT forget command prompt power:
First thing we need is the video ID which we are going to get using also wget together with grep.
First locate the page of the video you want to download, I will use for this example one showing compizfusion in action.
wget -O /tmp/page.tmp http://www.youtube.com/watch?v=UHvAXLBMWGI
Then using cat and grep we will get the video ID
cat /tmp/page.tmp | grep video_id=
This will be the output
var fullscreenUrl = '/watch_fullscreen?video_id=UHvAXLBMWGI&l=51&t=OEgsToPDskKBFLkte03dOnia39Rzd63j&sk=7Ayx8rGROMLJrkh6LkXj7AC&fs=1&title=CompizFusion'; var relatedVideoGridUrl = '/related_ajax?video_id=UHvAXLBMWGI&view_type=G&watch3=1&search=compiz%20linux%20ubuntu'; var relatedVideoListUrl = '/related_ajax?video_id=UHvAXLBMWGI&view_type=L&watch3=1&search=compiz%20linux%20ubuntu';
Check that you have more than one Video_id, but only the first one is the one we want, check that the others says “relatedVideo”, we do not want those ones.
Now download the video.
wget -O /tmp/video.flv ‘http://www.youtube.com/get_video?video_id=UHvAXLBMWGI&l=51&t=OEgsToPDskKBFLkte03dOnia39Rzd63j&sk=7Ayx8rGROMLJrkh6LkXj7AC&fs=1&title=CompizFusion’
check out that I am sending the output to /tmp/video.flv you of course can use any other file and directory you may want, after this you can play the video with any player you usually use.












December 8, 2007 at 4:22 pm
very interesting..
dear hisitech!
you are a good teacher..(did u know?!)
good luck