Tom Morris



2007.05.01

  No. 547 

MySpace API updated 2007-05-01T20:01:46ZPermalink

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

Comments
blog comments powered by Disqus


Tom Morris 9f4907d871750fd4c9b9bad7086701b51d6abd10 bd9f81a05283ed85e699175ed057b4a497f20b77 802c68123e12bf69d99a25a87cef360f18813fe4
Currently in: Kent, England
Usually in: East Sussex, England

I am a , an , like to code in and (and Java, but let’s not talk about that), and noodle about with and the .

I have an MA in philosophy from Heythrop College, University of London. My philosophical interests are in analytic metaphysics, ontology, modality, the work of , , , and . I have a strange, unfulfilled interest in . I’ve been influenced by Gadamer, by , , and .

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. I occasionally produce audio recordings for The Pod Delusion.

Elsewhere:

  • GPG Key
  • del.icio.us
  • Flickr
  • Twitter
  • 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 2010