Programming and Scripting :: Script for downloading Youtube videos



Don't look at me like that, I know it isn't useful.
But I just read Advanced bash scripting guide and I had to try my skills on something.. So here's a very much enhanced version of the one from nixcraft.

I added some looks, clarity, comments, help switch, ability to get urls from nearly unlimited number of args...

After download they can be watched with Mplayer or flash player, and edited with mencoder..

Try and comment it

Hey Curaga,

Not sure about this:

Code Sample
[[ $1 = http://* ]]


Try instead:

Code Sample
[ ${1%%://*} = http ]


to test if the beginning of the argument string is http://

EDIT: forget it, what you have works.  I wasn't looking at the double brackets.

I couldn't get it working.  I think it bombs out on the mktemp part.  I tried another name for tmp and it got further along.  Then it looked like error 303 on the wget.  Oh well interesting script.
I didn't create it on DSL, so mktemp might be missing. Just replace it with a name..
Isn't error 303 just a redirection? I get something like that always, Youtube has 3 servers to balance traffic..

More detailed usage:

Go to the Youtube video page you wish to download. Like here's a video of DSL:
http://www.youtube.com/watch?v=prjQ7MwuCWI
Copy that url. Then open Aterm and start this script (youtubedl if you haven't renamed)
and when it asks for that url, paste it there..

Or call it as "youtubedl http://www.youtube.com/watch?v=prjQ7MwuCWI"

Next Page...
original here.