MooFm: Last.fm data at your fingertips
I came accross some very neat Last.fm stats visualizations some times ago, and wanted to try out some ideas in JavaScript (probably with Processing.js).
I couldn’t find any efficient way to use their API from JS, so I made MooFm…
What is MooFm?
MooFm is a little (<5Ko) MooTools plugin making access to these data as easy as it can be.
It allows you to get the stats asynchronously without having to deal with query concatenation or Ajax calls.
How do I use it?
Let’s say we want to get the most popular album of Nirvana. Taking a look at the last.fm API guide, we find the documentation for the artist.getTopAlbums method.
// just give MooFm your API key... var moofm = new MooFm('b25b959554ed76058ac220b7b2e0a026'); var callback = function(resp) { // will output "Nevermind" alert(resp.topalbums.album[0].name); }; // methods' name and params are the same as in last.fm doc moofm.artist.getTopAlbums({'artist':'Nirvana'}, callback);
Couldn’t be simpler, right? All Last.fm readonly methods are accessible this way.
Getting started
To get started you’ll need a recent version of MooTools (obviously), the MooFm.js library and its proxy.
Now get an API key (free), and you’re good to go.
Demo
Here is a little demo I put together to show the plugin’s potential.
About this entry
- Title MooFm: Last.fm data at your fingertips
- Published3.2.09 / 2am
- Tags
javascript, last.fm, mootools
4 Comments
Jump to comment form | comments rss | trackback uri