[sf-lug] YouTube downloading

Rick Moen rick at linuxmafia.com
Wed May 18 02:42:14 PDT 2011

(Copying over a conversation from CABAL's mailing list:)

Date: Tue, 17 May 2011 19:49:43 -0700
From: Rick Moen <rick at linuxmafia.com>
To: conspire at linuxmafia.com
Subject: Re: [conspire] get back to me first
Organization: If you lived here, you'd be $HOME already.

Quoting Bruce Coston (jane_ikari at yahoo.com):

> I need to get a distro on one of my many small-ish laptop partitions
> that will play back YouTube videos I suck at the library after I
> suspend to disk and go home during our many summer Internet outages.
> My elive install suffers real problems with this, after I take it off
> disk suspend, back home.

Bruce --

I'm going to make a longer post on this subject that aims to be more
comprehensive, but here's the short version:

You're relying on local cache state of the Adobe Flash interpreter being
useful and complete after suspend to disk. Bad strategy. Instead,
install scripts or browser extensions to download the clips to local

Slight elaboration: I'm assuming Flash (Sorenson H.263 encoding in FLV
container) for the sake of discussion, though Google's YouTube service
also offers video in MPEG Licensing Authority's patent-problematic H.264
encoding in either FLV or MP4 (MPEG-4 Part 14) containers (often
inaccurately called 'HTML5' video), in Google's (ex-On2) VP8 encoding in
WebM containers (which along with Vorbis encoding in a Matroshka
container is part of the HTML5 draft), and in MPEG-4 Visual encoding in
3GP containers (a format primarily intended for mobile 'phones). It's
pretty much the same problem regardless.

Why a problem? Your media player plugin (Adobe Flash, for the sake of
discussion) is streaming-in the inbound A/V bitstream and dumping it
into ~/.mozilla/firefox/[hash]/Cache on an ongoing basis, but that
cached copy isn't guaranteed complete and useful at any given moment.
Also, it's not the least bit surprising to hear that Adobe Flash acts
stunned and stupid if it suddenly wakes up after being suspended to
disk. So, no, you're actually lucky if that ever works, because you can
be sure that the buggy spaghetti code in question isn't designed to do

So, let's say you look at the page HTML on a YouTube page to try to find
the .flv direct link so you can pull a copy down using wget or curl.
Surprise, you can't find it. Why not? Because you are not Google's
customer; you are their product -- and they are far, far more eager to
make Our Lords in Hollywood happy than they are you. So, they cause
YouTube to wrap the .flv link in inscrutable JavaScript, in order to
make it difficult to puzzle out. Moreover, they gratuitously change that
JavaScript obfuscation occasionally, to screw people up who've
de-obscured the latest version and are letting others know how.

(They do that because Our Lords in Hollywood don't want users to have
local copies that cannot be retroactively withdrawn from availability.)

Nonetheless, there are folks who gamely keep up with the changes, and
you can & should benefit from their work:

clive (Perl script)
cclive (newer C++ rewrite of clive)
youtube-dl (Python script)
Flash Video Downloader (Firefox extension)
Easy YouTube Downloader (Firefox extension)
Get 'em all.

There are distro packages for clive, cclive, youtube-dl (judging by
Debian). You may find the distro packages' frequency of update adequate
to keep up with JavaScript mischief at YouTube, Photobucket,
Dailymotion, Metacafe, Facebook, Yahoo, depositfiles.com, etc. -- or
not. If not, you might need to have them as locally installed and
updated software.


There's a persistent misconception, spread about by the ill-informed,
that the open source Flash interpreters (Gnash, Swfdec, and GPLFlash)
are inadequate to handle the Flash served by YouTube. No, wrong. It's
really just the obfuscatory JavaScript.[1] Which, if you use a
downloader such as those listed above, and it works, suddenly becomes a
non-problem. So, in addition to the recommendations above, please
consider losing the Adobe Flash proprietary garbage, or at least using
Gnash in preference. (For one thing, the Gnash developers don't spy on
users, about which please see http://lwn.net/Articles/129729/.)

[1] Adobe consistently withheld Flash's technical specifications from
the open source community, making selected details available only under
restrictive agreements. Starting June 2009, in the face of mounting
competition from alternatives (H.264 in MP4, VP8 in WebM, Vorbis in
Matroshka, and especially Microsoft Silverlight), they finally coughed
up the SWF file format specification without restriction, but omitted
anything about the key Real Time Messaging Protocol (RTMP) and Sorenson
Spark codec. Moreover, the open source community had already
independently reverse-engineered everything Adobe did disclose.

Date: Tue, 17 May 2011 19:55:15 -0700
From: Rick Moen <rick @linuxmafia.com>
To: conspire at linuxmafia.com
Subject: [conspire] YouTube downloading software (was: get back to me
Organization: If you lived here, you'd be $HOME already.

I should also acknowledge Micah Lee's really useful posting on this
subject. Thanks, Micah!

This is my compendium of links relative to my suggestion to Bruce
Coston, just posted
(http://linuxmafia.com/pipermail/conspire/2011-May/006225.html) that he
deal with his video streaming problem with YouTube and similar sites
through use of downloaders, which in turn can also permit, if he wishes,
losing that dreadful Adobe Flash plugin software and substituting
open-source compatibles (Gnash, Swfdec, GPLFlash).

Here's the laundry list, which I hope will prove useful. Remember, you
should usually favour distro packages where available, rather than going
to upstream links (such as those cited). All codebases mentioned are
genuine open source (except for Google's Chrome Web browser).

clive is a Flash video extraction tool in Perl for user-uploaded video
hosts such as Youtube, Google Video, Dailymotion, Guba, and Metacafe. It
can be chained with 3rd party tools for subsequent video re-encoding and
playing and playing. 

clive-utils is a collection of add-on tools to parse RSS feeds, parse
video pages, and manage login passwords related to video sites. 

cclive is a rewrite of clive in C++ for lower system load. 

abby is a Qt-based graphical front end in C++ for clive and cclive. 

youtube-dl is a (command-line) Python script for downloading Flash or
WebM (vp8 + Vorbis) video clips for YouTube.com, Google Video,
Photobucket, Yahoo Video, Dailymotion, DepositFiles, and some other
sites. You provide the clip's URL, and youtube-dl saves the clip as a
local file with file extension .flv. 

For maximum compatibility with even the more difficult (DRM-obscured)
YouTube clips, you should also install the rtmpdump program to decrypt
files served using Adobe's proprietary 'RTMP' protocol. See: 

YouTube Downloader GUI is a Qt/kdelibs front-end for youtube-dl: 

Qttube is a similar Qt front-end for youtube-dl: 

Flash Video Downloader is a Firefox extension to download Flash video
clips from YouTube, Dailymotion, Break.com, and many other sites. 

Easy YouTube Downloader is a Firefox (and Chromium / Chrome) extension
to download YouTube videos in FLV, 3GP, MP3, MP4 and 720p HD and 1080p
Full-HD qualities. 

quvi is a command-line tool in C for parsing Flash video links out of
YouTube and similar sites. 

PyTube is a Python app that searches and downloads YouTube video clips
and encodes them using FFMpeg: 
(gone from: http://bashterritory.com, http://www.getdeb.net/app/PyTube,

pytube (different codebase) is a Python script for YouTube and MetaCafe
that de-obscures the video clip's URL from its obscuring JavaScript, so
that you can download it. 

Note: There was for a long time a Python / gtk+2 graphical application
also called Pytube, but unfortunately everyone relied on someone else to
host it, and it it appears to have vanished from the Internet.

Utube Ripper (formerly Youtube Downloader for Linux) is an application
written in Gambas that works exclusively on Linux. It's useful to
download and convert Youtube videos in a simple and efficient way. 

(g)vdown is an application that can download videos from video sharing
websites like YouTube, Google Video, MyVideo and so on. It is written in
Python. It has a command-line interface (vdown) and a PyGTK interface

Get YouTube Video is a KDE service menu usable with Konqueror to 
download YouTube Flash video clips. 

gnetvideoplayer is a C program for GNOME that serves as a player and
downloader for YouTube and Stage6 videos, and depends on wget, MPlayer,
and GtkMediaPlayer. 

youshell is a Python script to search and download Flash video clips
from YouTube and load them into Mplayer. 

Elltube is a graphical Python / Qt4 YouTube Flash downloader and

MP3 Rocket is a Java program to download YouTube and other clips 


More information about the sf-lug mailing list