Thursday, May 19, 2005

This American Life downloads

I love greasemonkey. It's sort of a uber extension for firefox that lets you have hacky control over how pages display and what they do. The scripts for it are amazing.

So I wrote one.
This American Life is a radio show about everything and it is really smart and awesome - if you haven't listened to it you totally should.

Number 61 called "Fiasco" is my favorite.

They have a links to buy cd's from and they have links to realaudio streams that are free.
Unforunately, I like to listen to them on my pocket pc.
Here's a greasemonkey script that changes all the stream links to download links.
Install greasemonkey.
I don't have separate hosting, so just copy and paste this into a file and open it in firefox.
Then go to tools, and install user script.
Open - all ram links should point to the actual .rm files now for downloading.

Please feel free to improve on this. It might be nice if it offered you a separate link for downloading as opposed to streaming.

Why doesn't it work?!
Thanks for your input! Please let me know how it isn't working.

I am in the main page, none of the sub pages have the links converted.
You've got an old version! The new version works better better, sometimes. Thanks much to
Why is CRAWLING right now?
I had no idea so many people would use the script and the first version hit their servers directly.
I'm putting up a new version that hits the coral cache of it. Thanks Jaime Alesso!

If you know how to fix this, let me know, I'm looking at it.
Please email me if you can host the script, thanks.
update: fixed to work with firefox 1.5/greasemonkey 0.64

from here

// This Mobile life
// version 0.4 BETA!
// 2005-05-19
// Copyright (c) 2005, Matt Katz
// Released under the GPL license
// --------------------------------------------------------------------
// This is a Greasemonkey user script.
// To install, you need Greasemonkey:
// Then restart Firefox and revisit this script.
// Under Tools, there will be a new menu item to "Install User Script".
// Accept the default configuration and install.
// To uninstall, go to Tools/Manage User Scripts,
// select "This Mobile Life", and click Uninstall.
// --------------------------------------------------------------------
// ==UserScript==
// @name This Mobile Life
// @namespace
// @description Changes all This American Life ra stream links to link to the .rm file to download
// @include*
// @include http://**
// ==/UserScript==

var allLinks = unsafeWindow.document.getElementsByTagName("a");

for (i = 0; i < allLinks.length; i++)

var href = allLinks[i].href;
if (href.match(/ra\/([0-9]+).ram$/i) )

// alert('Hello world!');
var episode = href.match(/([0-9]+)/i);

//get the number to get the episode number
allLinks[i].setAttribute("href", "" + episode[1] + ".rm");