10.21.2004

Daily Show downloader for Linux

Anyone can go to the Comedy Central website and watch videos of The Daily Show but if you're like me you really hate watching small streaming videos through a browser and prefer to get the actual file and watch it full screen. Here's how to do it.

First go download majormms. It's a small program that downloads video files that use the Micro$oft mms protocol.

The only problem with majormms is that you have to view the html source, find the line that contains an .asx file, download the file and read it to find the actual video file. This script simply does all that crap for you. Remember that it only works for downloads of The Daily Show. It probably wouldn't be very much harder to adapt it to work for many other sites as well, but TDS is the only show I get from the web regularly so I simply don't care.

It's simple to use. Just go to The Daily Show site and click on a video you want to watch. When the page comes up with the little embedded video just hit stop and copy the URL and feed it to this script.

Oh, and uh, make sure the URL is in quotation marks (I can't remember how to fix that silly little problem, dammit).

Example: I named this script "getdaily" so if you wanted to get the video from this pageyou'd just type this:

./getdaily "URL"

Note: Majormms spits out gibberish like this so if you see it, it means it's working. If not, there's a problem:

asf media packet detected, len=2888
[72/2888][1520/2888][2888/2888]get media packet succ
[8/8]pre_header[0] = 16 (22)
pre_header[1] = 0c (12)
pre_header[2] = 00 (0)


When it's done it'll say "Downloaded 9046_headline.wmv". Soooo... without further ado, here's the stupid script...
#! /bin/sh
wget -O .tmpmms "$1"
asx=`cat .tmpmms | grep videoswitcher | awk '{ print $3 }' | grep -v pluginspage | perl -pi -e s/value\=\"//g | perl -pi -e s/asx\"\>/asx/g`
rm .tmpmms
wget -O .tmpmms "$asx"

mmsfile=`cat .tmpmms | grep wmv | grep -v "ads" | perl -pi -e s/\/wmv/g"`

video=`basename $mmsfile`
if mms $mmsfile; then
echo
echo "Downloaded $video"
else
echo
echo "Something went wrong, the video was not downloaded"
echo "Hit CTRL + C to abort"
fi
rm .tmpmms
Enjoy.



<< Home

This page is powered by Blogger. Isn't yours?