Skip to main content

MySpace: Welcome to Web 0.5 (and a Y!Maps toy)

I'm not much into social networking sites. I joined the big wave of PHPers on LinkedIn, but I haven't really used it. Some of my friends/clients, however, are really into MySpace.

Sunny (my aforementioned friend), uses MySpace to promote his band. He maintains his upcoming tour dates within his MySpace profile. I maintain the code behind his site (he maintains the content), and I thought it would be a nice feature if he could update his tour dates in a single place, and have them syndicated elsewhere.

Since (as far as I can tell) there's no real API to update MySpace, the only viable way to achieve a central datastore is to read from MySpace. "No problem," I thought, "I'll just write up a quick wrapper for whatever format they use for Upcoming Show syndication."

(Read on to see the Flash app I came up with as a result of this whole adventure.)

Turns out, there's no API for that, either.

Great. What is this? 2002? "On to Plan B." Plan B involves page scraping. Remember that? It's that thing we did back in the olden days, before RSS caught on. It involves some sort of network layer to grab the content (PHP's streams to the rescue, here), and usually a huge regular expression or three. Where's the Semantic Web when we need it? (side note: notice the "2001" in that URL? Yeah.)

I'm going to let that (side note) distraction lead me on another tangent: What's with MySpace, anyway? It's the new Geocities. It's got the be the biggest mess on the Web (but not the Internet as a whole--that title is reserved for the current state of email). All that it's missing is blinking text, "under construction" logos, background music, animated word-art, impossible-to-read-text-on-background-images, and HUGE FONTS. Oh wait, no.. it's not missing any of that.

Note also that MySpace is not only behind on tech when it comes to new-Web things like RSS, but if you've ever had the.. uh.. pleasure of looking at MySpace's HTML source (and you didn't immediately pluck out your eyeballs), you'll agree with me that the markup is reminiscent of mid-90s-era HTML 3.0.

MySpace: I declare you Web 0.5 compliant. Congrats! (Well, I guess retro is in... right?)

So, (back on topic) I whipped something up to fake syndication. If your band happens to have a MySpace profile, and you maintain your tour dates on MySpace, first accept my apologies for that, then take a look at: http://www.caedmon.net/msm/rss.php?fid=brandnew (where brandnew is your myspace friendid (name or number)).

It's certainly not foolproof, but it allows for cool things like this Live Map: http://www.caedmon.net/msm/map.php?fid=brandnew.

Anway, the RSS allowed me to integrate Sunny's tour dates into his site (if you look closely, you'll see the foolish parts that are not um.. proofed). Mission accomplished.

But that map thing is really cool. I wanted him to be able to integrate a live version of the map into his profile page.

Fortunately, Yahoo! has cool developer tools, including for Y!Maps. (Rasmus blogged about these, a while back.)

MySpace, by their very nature, has had to lock down their profile pages, somewhat. This means: no JavaScript, no IFrames (because of XSS, CSRF, and the potential for worms). Some creative users have, however, figured out how to bypass some of their safeguards (see this -- typical MySpace warnings apply (it plays music)).

So, a big no-go on putting the map into an IFrame. Time to dust off Flash (and download a fresh 30-day trial! (-; ). MySpace allows embedding... but adds attributes to the tag so Flash can't script page elements.

A few hours later, I managed to concoct the 60-or-so lines of ActionScript (Flash's scripting language) required to pull off a Flash version. (I first tried to overlay my RSS, but something was mysteriously broken.)

Voila:

Check the source of this post for embedding details. The URL is: http://www.caedmon.net/msm/flash/msm.swf?brandnew (again, brandnew is the MySpace FriendID).

Enjoy. If you use any of this stuff, let me know.

Oh, and to MySpace: shame on you; update thyself!