About

User

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!

S


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

  1. 204 SantosJ 2006-06-10 18:38

    I hope for the day when you can have a social network without depending on MySpace or the other spew of sites out there.

    The only issue is that you would have to store the sites in some place and well, it would be far to difficult to depend on others.

    I also wrote my first blog post on myspace ranting about similar things. Myspace for the most part has a lot of features, but it is also seriously lacking in others.

  2. 205 Christine K. 2006-06-13 03:21

    I fully agree. MySpace is an insult to web development. :\

  3. 203 Jay K. 2006-06-14 18:41

    Great work! My wife just recently was asking me to style her MySpace Site. After looking at their code, I gave up and referred her to google.

    Is there anyway you'd share the code you've done?

  4. 202 Matthew Turland 2006-06-22 13:59

    I wrote something at one point to import shows from MySpace into a local database, although it made use of regular expressions and was fairly messy. This was before I found the DOM XML extension that I now love so dearly. You are correct as far as I'm aware in that there's no API or web service or any other means of extracting information from MySpace that doesn't involve just fetching and parsing the data from HTML yourself. I will agree with all statements that MySpace is an insult to web development and share in the surprise that it's come as far as it has in pop culture.

  5. 206 Butch Ross 2007-03-06 12:07

    Found this post on Google, and subsequently stole the code. Thank you, it's a godsend. I'd like to link back to ya, what page would you like me to link to?

  6. 207 Sean Coates 2007-03-06 15:40

    This one is fine.

    ( http://blog.phpdoc.info/39-MySpace-Welcome-to-Web-0.5-and-a-Y!Maps-toy.html )

    S

  7. 208 Ryan 2007-03-31 03:15

    ERROR! I JUST discovered this site and its already down. This is the ONLY thing i've found that parses out myspace tour dates, a massive time-saver for all the people making websites for bands.

    Is there any chance of getting this fixed?

  8. 209 nick 2007-11-23 00:30

    i'm trying to find a way to do this, the links are down, i went to the bands page and checked the source but didn't see it... help?

Leave a Reply




Clicky Web Analytics