I've been bothered by the fact that it was difficult to view videos from the CNN website in Linux, so I did some searching for answers. I found a few references to Greasemonkey scripts, but all that I found required strange contortions, like right-clicking the video links and selecting "Save As". Of course, they all also required the installation of Greasemonkey.
I noticed that in Opera, it's possible to take over and rewrite JavaScript delivered by any site without using Greasemonkey. In Opera configuration, one can right-click any web page, select "Edit Site Preferences" click the Scripting tab of the resulting dialog box, and specify a User JavaScript file.
But, how do you go about replacing CNN's cnnVideo JavaScript with something that works in Linux? That took a little more searching: On the Opera website, there's a short tutorial on Opera User JavaScript that provided the answers.
After a bit more head-scratching, reading, and poking at bits of JavaScript, I came up with this:
function LcnnVideo(junk1, url, junk2) {
var newurl = "http://dynamic.cnn.com/apps/tp" + url + "/video.ws.asx";
window.top.location.href=newurl;
}
window.opera.addEventListener(
'BeforeJavascriptURL',
function (e) {
e.source = e.source.replace('cnnVideo', 'LcnnVideo');
},
false
);
Save that in a file, go to cnn.com in Opera, right-click a blank spot on the page, select Edit Site Preferences, click the Scripting tab, enter the path to the file, and click OK. Now, refresh the cnn.com page and click a video link. The first time through, you'll be asked whether to open or save this or that; just select Open and click the box to indicate that Opera should remember your choice. (Okay, to be cautious, don't tell Opera to remember your choice before you've tested this. But, after you've confirmed that it works, tell Opera to remember your choices.)
Now, anytime you click a video link on CNN, you'll get straight to the video. No more "Windows Media Player Not Found" messages!
Here's another detail, if it doesn't work: Make sure you've specified your preferred media player as the default for the .asx file type, and be sure your media player can play .asx files. Also, make sure that Opera is set up to handle .asx files using your media player. To do that, click Tools | Preferences | Advanced | Downloads and look at the MIME types. You need to configure your media player to handle the video/x-ms-asf MIME type for asf and asx extensions, if it's not already done.
Comments
Moot Point
This is moot. I've just installed Ubuntu 7.10, and CNN video works in Firefox. CNN video seems Flash-based now, and it works without problems in Ubuntu 7.10 once you've installed the Flash plug-in.