Sunday, November 19, 2006

Download videos from YouTube

This script downloads the given video from YouTube and converts it into mpg.



#!/bin/bash
if [ ! -f /usr/bin/zenity ]
then
`zenity --info --text="Zenity is not installed"`
exit
fi

vedio_name=`zenity --entry --title="file name" --text="name of the vedio" --entry-text="you"`

if [ ! $vedio_name ];then
`zenity --info --text="Vedio name should be given"`
exit
fi

youtube_url=`zenity --entry --title="URL" --text="Vedio URL:"`

if [ ! $youtube_url ];then
`zenity --info --text="URL should be given"`
exit
fi
tmp_file=`echo $vedio_name | sed "s/ /_/g"`

`wget "$youtube_url" -O "${tmp_file}"`
swf='http://youtube.com/get_video.php?'`grep player2.swf "$tmp_file" | cut -d? -f2 | cut -d\" -f1`
`wget "$swf" -O ${tmp_file}.flv`
`ffmpeg -ab 56 -ar 22050 -b 500 -s 320x240 -i $tmp_file.flv ~/Desktop/"${vedio_name}".mpg`


if [ $? ];then
`zenity --info --text="Successful"`
else
`zenity --info --text="Not Successful"`
fi



If you are a fan of hindi oldies, these are some of the oldies I have downloaded.
Aaja Aayee Bahaar.mpg
bahon mechale aon.mpg
Chahoonga Maein Tujhe .mpg
Dil kiya kaire.mpg
Ehsaan Tera Hoga.mpg
Ek Mein Aur Ek Tu.mpg
hamen aur jeene ki.mpg
Haseen Dilruba Kareeb Aa Zara.mpg
Kabhie Kabhie.mpg
Kya Huwa Tera Wada.mpg
Lila o Lila.mpg
Maine Tere Liye Hi.mpg
Main Na Milungi.mpg
Oh Haseena Zulfoa.mpg
roop tera mastana.mpg
Sau_Saal_Pehle.mpg
Tere Bina Zindagi Se.mpg
Tere Ghar Ke Samne.mpg
Tujhko Pukare Mera Pyar.mpg
Yahoo.mpg
Ye Ladka.mpg
Ye Sham Mastanee.mpg

No comments: