Last.fm API weekly charts
JavaScript
var LFM = function(completed, method, data) {
new Request.JSONP({
url: 'http://ws.audioscrobbler.com/2.0/',
data: $merge({
method: method,
user: 'wassago_',
api_key: 'b25b959554ed76058ac220b7b2e0a026',
format: 'json'
}, data),
onComplete: completed.bind()
}).send();
};
LFM(function(response) {
response.weeklyalbumchart.album.each(function(album) {
//console.log(album);
coverArt = LFM(function(response) {
if (response.album) {
// console.log(response.album.image[0]['#text']);
var img = '<img src="' + response.album.image[0]['#text'] + '" />';
}
new Element('li', {
html: img + album.artist['#text'] + ' - ' + album.name + ' ' + album.playcount
}).inject($('list'));
}, 'album.getInfo', {
mbid: album.mbid
});
//console.log(coverArt);
});
}, 'user.getweeklyalbumchart');