Was bored today,so i just thought to code a simple bash script to download a youtube video using bash. You can have a look at the source to be clear about how it’s done. Mostly i have used wget command to download source and the video file from youtube and cut, awk and grep to parse various values from the source.
#!/bin/bash
#Youtube video downloader
#coder : Anil Dewani
read -p "Youtube.com URL :" url
read -p "Name the video(no spaces please) :" name
wget ${url} -O source.txt >/dev/null 2>&1
videoid=$(echo $url | awk -F "v=" '{print $2}')
ticket=$(grep "&t=" source.txt | awk -F "&t=" '{print $2}' | cut -d"&" -f1)
base="http://www.youtube.com/get_video?video_id="
downloadurl=${base}${videoid}"&t="${ticket}
rm -f source.txt
echo "Downloading video..."
echo "This may take a while...please wait"
wget ${downloadurl} -O ${name}.flv >/dev/null 2>&1
echo "Video Download Succesfull. File saved as ${name}.flv"
#Youtube video downloader
#coder : Anil Dewani
read -p "Youtube.com URL :" url
read -p "Name the video(no spaces please) :" name
wget ${url} -O source.txt >/dev/null 2>&1
videoid=$(echo $url | awk -F "v=" '{print $2}')
ticket=$(grep "&t=" source.txt | awk -F "&t=" '{print $2}' | cut -d"&" -f1)
base="http://www.youtube.com/get_video?video_id="
downloadurl=${base}${videoid}"&t="${ticket}
rm -f source.txt
echo "Downloading video..."
echo "This may take a while...please wait"
wget ${downloadurl} -O ${name}.flv >/dev/null 2>&1
echo "Video Download Succesfull. File saved as ${name}.flv"
Usage:
[anil@server ~]$ ./utube.sh
Youtube.com URL :http://www.youtube.com/watch?v=oaO-LgxNjB8
Name the video(no spaces please) :justdance
Downloading video...
This may take a while...please wait
Video Download Succesfull. File saved as justdance.flv
Youtube.com URL :http://www.youtube.com/watch?v=oaO-LgxNjB8
Name the video(no spaces please) :justdance
Downloading video...
This may take a while...please wait
Video Download Succesfull. File saved as justdance.flv

eh! rocking information and coding.. it will be sure helpful for me
thnxx >:D<
Thanks Rishabh, keep visiting
eh! rocking information and coding.. it will be sure helpful for me
thnxx >:D<