foiled!
Because I've been working pretty hard this week, and because my plate of things that have to get done right away turned out to be relatively small today, I decided to treat myself to a little recreational nerdery this afternoon. Sadly, it wasn't successful. But I'm posting anyway in order to help the nerds of the future.
See, I really, really hate that MySpace doesn't let you link directly to songs. Not necessarily the raw MP3 (though my hardline copyfighting inclincations say they should), but at least to the band page with something in the URL that tells it: "Play this particular song. Don't just randomly select one of the other, crappier ones in the featured playlist. I want to send this to my friends, goddammit."
So I fired up Ethereal and the Firefox LiveHTTPHeaders plugin and started looking at the conversation that happens between your computer and MySpace when you click on a song in their Flash audio player.
First things: an XML file comes back, specifying the playlist. It's called mediaxmlprovider.xml, and it's served by a fairly easy-to-find URL (which has to be passed some of the random codes specified in the HTML of the band's page — I didn't bother to confirm this, but it seems pretty likely). The contents of the file look like this:
<?xml version="1.0" encoding="iso-8859-1"?>
<profile>
<timestamp><![CDATA[1150454435]]></timestamp>
<name><![CDATA[regina spektor]]></name>
<playstoday><![CDATA[33341]]></playstoday>
<downloadedtoday><![CDATA[0]]></downloadedtoday>
<totalplays><![CDATA[1811136]]></totalplays>
<autoplay><![CDATA[0]]></autoplay>
<allowadd><![CDATA[1]]></allowadd>
<playlist><song bsid="7548074" title="Fidelity" songid="0" plays="685573" comments="" rate="" downloadable=""
imagename="http://c.myspace.com/BandSongs/48/41/3071484/bs7548074_m.jpg" imagedesc="Begin To Hope<br>2006 Sire Records" filename="48/41/3071484/3071484_c4b21abc.mp3" url="http://home.myspace.com/Services/Media/mediaHitCounter.ashx?i=MIGdB
gorBgEEAYI3WAOuoIGOMIGLBgorBgEEAYI3WAMBoH0wewIDAgABAgJmAwICAMAE
CNxa3NiUig5fBBBBZNK8fzHa3nXq%2fQXZNaSJBFClWYkcVz5a2X%2bUe5yft5iC9Cn
mboEQKrW%2fPBrUqXlO7VwTgCxy%2bptjwvoaQsx2O4AAqXzpF63IosE0kZY0bsZ
k1XznxMS9l8rzeTgwz14T9w%3d%3d" lyrics="" purl=""/><song bsid="7494789" title="Better" songid="0" plays="358965" comments="" rate="" downloadable=""
imagename="http://c.myspace.com/BandSongs/48/41/3071484/bs7494789_m.jpg" imagedesc="Begin To Hope<br>2006 Sire Records" filename="48/41/3071484/3071484_141017ab.mp3" url="http://home.myspace.com/Services/Media/mediaHitCounter.ashx?i=
MIGdBgorBgEEAYI3WAOuoIGOMIGLBgorBgEEAYI3WAMBoH0wewIDAgABAgJmAwIC
AMAECLuj4EHcSIfyBBD5z%2fO%2bh8P26LaTqDiG07JMBFBq5PV2kJDM%2b07hGBsp
xCmC3nxdreIiWFPw4nt3onOecM5NqoOaEjWPyNYCOvCD8X77svdho%2bSmW7Ok
a9F67YoFS10RfyZ0UADznDzj6ZJelg%3d%3d" lyrics="" purl=""/><song bsid="67359" title="Us" songid="42627" plays="336564" comments="42627" rate="42627" downloadable=""
imagename="http://c.myspace.com/BandSongs/48/41/3071484/bs373400284_m.jpg" imagedesc="Soviet Kitsch<br>2004 Sire Records" filename="48/41/3071484/3071484_e2b7a709.mp3" url="http://home.myspace.com/Services/Media/mediaHitCounter.ashx?i=MIGVBgor
BgEEAYI3WAOuoIGGMIGDBgorBgEEAYI3WAMBoHUwcwIDAgABAgJmAwICAMAECFG4n
aZwuIbOBBDLD%2flDSGXRFNcjgKaiVaXWBEjwVg5Sd1IoyLFpHt%2fb85q41kwbAwufnVR
CexWU%2fziYdY66mVw7vIGNx37awMxokOQ%2foEtupSdopInRyczeNZCRfb3wI4G1VIM%3d" lyrics="" purl=""/><song bsid="67063" title="Ghost of Corporate Future" songid="42522" plays="387912" comments="42522" rate="42522" downloadable=""
imagename="http://c.myspace.com/BandSongs/48/41/3071484/bs356236944_m.jpg" imagedesc="Soviet Kitsch<br>2004 Sire Records" filename="48/41/3071484/3071484_8fcdc23f.mp3" url="http://home.myspace.com/Services/Media/mediaHitCounter.ashx?i=MIGVBgor
BgEEAYI3WAOuoIGGMIGDBgorBgEEAYI3WAMBoHUwcwIDAgABAgJmAwICAMAECPTQc
TjZI5BPBBDldE4GvP%2bEfHTN%2bZP%2fyPupBEhHCQ6QrxvOGCaM5nRpJPRJO35ivJEb
6%2f%2fTVNDzWOPiZj04wesbPi6WP9jUubZFoXdQ7UIW92EqnCvEOnYM9c1Mqfdoyzy4
ZZ0%3d" lyrics="" purl=""/>
</playlist>
</profile>
Those yellow parts look pretty promising. In fact, it seemed like this might be susceptible to a variation on this method (which has since become outdated). But those mp3 filenames are relative URLs, not absolute, and I got 404s when I tried them against any of the likeliest domains & paths.
It's possible that URLs like http://c.myspace.com/BandSongs/48/41/3071484/3071484_8fcdc23f.mp3 were just being clever, noticing my lack of a myspace.com HTTP referer, and lying to me about the file's presence. But I don't think so: I went to the page of a random band that offers downloads and found that the URLs used to obtain the mp3 look like this:
http://mp3download.myspace.com/index.cfm?fuseaction=bandprofile.downloadSong&bsid=11466&song_name=Its Dange&fid=1943559
There's no redirect or anything like that going on here. It looks like they've set up a dedicated mp3 gateway that serves the song out of a non-public part of their filesystem. This lets them lock things down as tightly as they care to — ie, they can check against the database to see if a song is genuinely supposed to be downloadable before sending it out. Nuts.
Of course, the Flash player still has to get the audio somehow. But I don't know enough about Flash to figure out how that happens. If I had to guess I'd say that it might use a proprietary (and secure) Flash streaming audio solution. It's still possible to grab the audio to an mp3 — until we get trusted computing forced on us, it'll always be possible — but for purposes of linking directly to mp3s, there isn't a lot of remaining promise here. Not that I can see, anyway.
Ah well. Perhaps a cleverer geek will pick up the mantle and figure out how to make MySpace mp3bloggable. Or perhaps MySpace will eventually remove its head from its ass and allow incoming links to specify particular songs. Till then I'll maintain the attitude of apathy and gradually-spreading terror that I'd been directing at the site up until this point.
