On Fri, Jun 18, 2010 at 11:12:44PM +0000, Jacob Meuser wrote:
> > And yt or youtube-dl from ports. Also, the greasmonkey scripts or
> > whatever for firefox work great for youtube, vimeo and a few others.
> 
> yeah, greasemonkey + "youtube without flash auto" is *way* better
> than swfdec or gnash for watching/downloading videos.
> 
> http://userscripts.org/scripts/show/50771

These prepackaged choices (yt, youtube-dl, and the greasemonkey script)
are all a little too bloated for my taste.  Did you notice that the
youtube-dl script

 http://bitbucket.org/rg3/youtube-dl/src/tip/youtube-dl

is over 2000 lines long!  That's longer than the Surf web browser (which
is under 1000 lines).

 http://hg.suckless.org/surf/file/e83fbd17d63a/surf.c

I would rather maintain my own 4 line shell script for downloading
youtube videos:

sed -n 's/[^v]*v.\([^&'\'']*\).*/curl '\''http:\/\/www.youtube.com\/ge'\
't_video_info?video_id=\1'\'' ; echo/p' | sh | sed -n 's/.*&video_id=\'\
'([^&'\'']*\).*&token=\([^%'\'']*\).*/curl -L -o '\''\1.mp4'\'' '\''ht'\
'tp:\/\/www.youtube.com\/get_video?video_id=\1\&t=\2=\&fmt=18'\''/p' | sh

The script takes URLs for youtube videos as standard input (one per
line), and downloads the mp4 files.  And if it doesn't do exactly what I
need, then I customize it.

Understanding youtube's API is easier than depending on somebody else's
code, in my opinion.

Reply via email to