Tuesday, March 14, 2006

Circumventing Flash Video on Linux

It is quite irritating when trying to view a piece of video, only to find that if you run Linux it is not supported. Read on for how get around this problem.

I am a Saturday Night Live fan and someone sent me a link to the Natalie Portman Raps skit at NBC (http://www.nbc.com/Video/videos/snl_1439_natalieraps.shtml). So after clicking on the link, the site tells me that it requires me to get a newer version of the Macromedia Flash player in order to play the video. Hmmm, this makes me wonder because I have recently upgraded to the latest version (7.0.61).

After digging through the Javascript on the page I find that if the browser is IE it simply plays the video without further delay. However, if your browser is not IE, it checks for the version of Flash player you have installed. If the version is less than 8.0 you cannot play the video. This is odd because I cannot find a version higher than 7.0.61.

After further examination we find the following code:

var pathToASX='/nbc/Video/asx/';
var isIE = (navigator.appName.indexOf('Microsoft')+1);
var content='Saturday_Night_Live/snl_1439_natalieraps';
var trafficPlay=true;
function init()
{
if(isIE)
{
playClip(content);
} else {
MM_CheckFlashVersion('8,0,0,0','Content on this page requires a newer version of Macromedia Flash Player. Do you want to download it now?');
}
}
function playClip(clip)
{
document.contentObj.URL=pathToASX+clip+'.asx';
}


In order to get around the problem we have to first get a URL to the real video. Here's how we do it. Following the above code, if your browser is Internet Explorer (heaven forbid) the code simply calls playClip() passing the 'content' variable which is:

'Saturday_Night_Live/snl_1439_natalieraps'.


Jump down to the playClip() function to see that the 'content' variable (now called 'clip') gets appended to the 'pathToASX' variable:

'/nbc/Video/asx/'


... which works out to:

'/nbc/Video/asx/Saturday_Night_Live/snl_1439_natalieraps'


Lastly the 'asx' suffix is added to form the complete path to the asx file:

'/nbc/Video/asx/Saturday_Night_Live/snl_1439_natalieraps.asx'


Right, now we prepend 'http://www.nbc.com/' and get that file:

wget http://www.nbc.com/nbc/Video/asx/Saturday_Night_Live/snl_1439_natalieraps.asx


...which looks like this:

<ASX version="3.0">
<ENTRY>
<REF href="http://g.msn.com/0VD0/02/26?m=snl_1439_natalieraps.wmv&csid=3&sd=mbr"/>
<REF href="http://g.msn.com/0VD0/02/26?m=snl_1439_natalieraps.wmv&csid=3&sd=mbr"/>
<REF href="http://g.msn.com/0VD0/02/26?m=snl_1439_natalieraps.wmv&csid=3&sd=mbr"/>
<TITLE>SNL - Natalie Raps</TITLE>
<ABSTRACT>A day in the life of Natalie Portman.</ABSTRACT>
<COPYRIGHT>Copyright (c)2005, NBC Universal</COPYRIGHT>
</ENTRY>
</ASX>


Ok, this file is simply more indirection so we get the embedded URL as follows:

wget 'http://g.msn.com/0VD0/02/26?m=snl_1439_natalieraps.wmv&csid=3&sd=mbr'


... which gives us another file containing the actual link to the mms stream. It looks like this:

<asx version="3.0"><entry><ref href="mms://od-msn.msn.com/3/MBR/snl_1439_natalieraps.wmv" /></entry></asx>


So now we have the mms URL:

mms://od-msn.msn.com/3/MBR/snl_1439_natalieraps.wmv


To get this onto our box we need the mmsclient program. I won't go into how to download and compile this but it is very straightforward for a Linux user.

Use the mmsclient program as follows:

mmsclient mms://od-msn.msn.com/3/MBR/snl_1439_natalieraps.wmv


... and that is it. After that completes you will have your very own copy of Natalie Raps. I must say that it wasn't really worth the extra work to download it but I figured someone may benefit by learning how to do it.

Questions can be sent to me via email on the link to the right.

Someone who has the time should write a script or something to automate this process. I just don't have the time right now.


Technorati Tags: , , , , ,

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home