Youtube-lst

Yeah... I had this done in Ocaml a while back... but I lost it somewhere, so I rewrote it in Bash + AWK. Good news is that it turned out to be much more simple.

I also tried to figure out if this is legal or not. I do not know this, in the end, but I figure, that all I'm doing is looping through a list, and youtube-dl is doing all the work, really.

Yeah, so it follows that youtube-dl is, of course, a dependency or a requirement.

Oh... and I didn't mention what it does yet, either... Well, if you want to download a video from Youtube to watch it later, while you're sitting in your hotel room deprived of your only link to civilization, the Internet, courtesy of your employer, or similar - in that situation you use youtube-dl, and everything's fine. If you're there for weeks on end though, you might want to get maybe 10 videos or something - then you can use this program.

First, you make a file, which lists all the files you want to look at. These files include either just lines with addresses, like this:
http://www.youtube.com/watch?v=nQmAGBbOmas
http://www.youtube.com/watch?v=-bMdTmRae6c

or with filenames like this:
-o megadeth.flv http://www.youtube.com/watch?v=1qKGZ4Ysy5M

You can put other parameters for youtube-dl in there as well - you can see in line 26 that this entire string is just inserted as-is into the command.

Here's the code:
#!/bin/bash

# Batch downloader for youtube-dl

# Prepare a list of addresses in a file and get
# then with just one command, which does all the
# tedious copy-and-pasting for you...
#
# Parameters
10#   Files contaning adresses.
11#   If you need to rename the files, prefix the
12#   addresses with: -o <filename>.flv
13# Requires
14#   youtube-dl to do the actual downloading
15#   (http://www.arrakis.es/~rggi3/youtube-dl/)
16# Author
17#   Konrad Siek
18
19# Expect each argument to be a file
20# and loop through all of these.
21for file in $@
22do
23    # Download each resource thorugh youtube-dl.
24    cat $file | \
25    awk '/^[ \t]*$/ {next}{system("youtube-dl "$0)}'
26done


Note that youtube-dl was developed on the desert planet.

The code is also available at GitHub as bash/youtube-lst.

lala moulati ana9a maghribia

seo

 

Blogroll

Site Info

Text

telechargementz Copyright © 2009 WoodMag is Designed by Ipietoon for Free Blogger Template