getTopArtists

jamesfleeting edited this page Jun 8, 2011 · 2 revisions

Artist Available Data

  • name
  • mbid
  • playcount
  • link
  • streamable
  • image.small
  • image.medium
  • image.large
  • image.extralarge

Example Usage

$.simpleLastFM({
	apikey: 'XXXXXXXXXXXXXXXX', //Get it at http://www.last.fm/api/account
	username: 'YOURUSERNAME',
	method: 'getTopArtists',
	limit: 7, //Max is 200
	period: 'overall',
	success: function(results) {
		html = '<h2>Top Artists</h2>';
		$(results).each(function() {
			html += '<strong>Artist</strong>: '+this.name+' (mbid: '+this.mbid+')<br />';
			html += '<strong>Playcount</strong>: '+this.playcount+'<br />';
			html += '<strong>Link</strong>: <a href="'+this.link+'">'+this.link+'</a><br />';
			html += '<strong>Streamable</strong>: '+this.streamable+'<br />';
			html += '<strong>Images</strong>:<br />';
			html += '<img src="'+this.image.extralarge+'"> <img src="'+this.image.large+'"> <img src="'+this.image.medium+'"> <img src="'+this.image.small+'"></p>';
		});

		$("#topArtists").html(html);
	},
	error: function(error) {
		$("#topArtists").html('<p>'+error+'</p>');
	}
});