2007.05.01

MySpace API updated 2007-05-01T20:01:46ZTitled entry permalink

I have updated the unofficial MySpace API that I built a while back. It now turns out decent quality JSON.

The XML has been moved around a little bit, but so long as you aren't using some kind of insane regular expressions based parsing or something, it should all work.

One other thing I've changed is that we now do not have the 'alumni' status. It wasn't working before - it just returned an empty XML element. I've removed it until I can get around to updating the screenscraper to pull it again.

Reworking this has forced me to learn how to handle data methods in Python a bit better - namely, the fact that you can have lists and dictionaries within one another. Python and JSON really are a nice combination. I have a really simple PHP script to turn this kind of data in to XML, and then I can use XSLT to rejig the XML in to other formats (OPML, RSS and RDF/XML, for instance).

It's quite a neat setup I've now got going. Any language that can turn out JSON can be used to find and build the initial data structure (Perl, Python and PHP - in reverse order - are usual suspects for me). Then a simple PHP script to XMLize the data. Then PHP and/or (E)XSLT to do transforms on that data. This really separates out the process. Fixing the scraper doesn't interfere with the presentation layer (ie. the 'XSLT layer'). Needing to tweak an XSLT file doesn't break the scraper either.

With judicious use of .htaccess, it makes it quite easy to provide a decent service for people.

The MySpace API, then:

xml.opiumfield.com/myspace/username/format

username is either the 'friend ID' or the username in the URL. Format can be either 'json', 'xml', 'rss', 'opml' or 'rdf'.

JSON, XML, RDF and OPML are self-explanatory. RSS is an RSS feed of comments posted on that profile.

Comments | TrackBack

 

Login with your OpenID:
No. 547
Tom Morris
Currently in: East Sussex, England
Usually in: East Sussex, United Kingdom
AIM: tommorris
YIM: tom.morris

I am a , an , like to code in and noodle about with and the . I also have a BA in philosophy from London, and am studying for an MA. My philosophical interests are in Victorian-era German philosophy, Kierkegaard, Robert Nozick, hermeneutics and current approaches to the demarcation problem in the philosophy of science. Musically, I like jazz fusion, soul and P-Funk. My musical nirvana would be a mixture of Beethoven, Miles Davis and George Clinton topped with a side-serving of Erykah, Jill and Angie.

I also write for the Citizendium, an online encyclopedia project. If you know about stuff, you should join in.

Elsewhere:

  • GPG Key
  • del.icio.us
  • Flickr
  • Twitter
  • digg
  • Jaiku
  • LinkedIn
  • ma.gnolia
  • blip.tv
  • upcoming.org
  • MetaFilter
  • LiveJournal
  • CiteULike
  • Technorati Profile

RSS Feed Subscribe:

RDF

« May 2007 »
SuMoTuWeThFrSa
 12345
6789101112
13141516171819
20212223242526
2728293031 

View in month context

On this day in: 2006 2008