Downloading youtube videos is always a pita, some use firefox plugins, some install a windows app to snatch loaded flash videos, and some just want to use native shell without X – like me.

For gods sake, there is a debian package called youtube-dl which is available in wheezy and sid, but luckily backported to squeeze-backports as well.

IF using debian squeeze, first add the backports repository like described here.

# echo "deb http://backports.debian.org/debian-backports squeeze-backports main" > /etc/apt/sources.list.d/backports.list
# apt-get update

Install it from backports (which is lower priority than your systems repo).

# apt-get -t squeeze-backports install youtube-dl

and run “man youtube-dl” to see all available options.

Below is an example of a 10h set of ASOT 550 which is rather huge.

$ youtube-dl "http://www.youtube.com/watch?v=2zJOJbJeSZc" -o A_State_of_Trance_550_Den_Bosch_-_Blue_Stage_Full_Set.flv
 Setting language
 2zJOJbJeSZc: Downloading video webpage
 2zJOJbJeSZc: Downloading video info webpage
 2zJOJbJeSZc: Extracting video information
[download] Destination: A_State_of_Trance_550_Den_Bosch_-_Blue_Stage_Full_Set.flv
[download]   0.1% of 3.20G at    1.05M/s ETA 51:45

After downloading, you’ll get a flash video file (*.flv extension) which can be either played with VLC and comparable players, or encoded with ffmpeg, mplayer, etc. Keep in mind that h264 files will result in *.mp4 extension – so make sure to check that before defining the -o parameter.

For those interested in the origin source – it’s a python script kept updated on github: https://github.com/rg3/youtube-dl/

%d bloggers like this: