Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 529395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:05:15+00:00 2026-05-13T09:05:15+00:00

I am trying to customize this script so that instead of a user’s recent

  • 0

I am trying to customize this script so that instead of a user’s recent tracks it will display a user’s favourite artists.

This is what I have come up with, however it doesn’t work whatsoever. I thought it would be easy changing the attributes of the feed, but obviously not…

(function($){
$.fn.lastFM = function(options) {

var defaults = {
number: 10,
username: 'willblackmore',
apikey: '96e0589327a3f120074f74dbc8ec6443',
artSize: 'medium',
noart: 'images/noartwork.gif',
onComplete: function(){}
},
settings = $.extend({}, defaults, options);



var lastUrl = 'http://ws.audioscrobbler.com/2.0/?method=user.gettopartists&user='+settings.username+'&api_key='+settings.apikey+'+'&limit='+settings.number+'&format=json&callback=?';
var $this = $(this);

var container = $this.html();

$this.children(':first').remove();

if(settings.artSize == 'small'){imgSize = 0}
if(settings.artSize == 'medium'){imgSize = 1}
if(settings.artSize == 'large'){imgSize = 2}

this.each(function() {

$.getJSON(lastUrl, function(data){ 
 $.each(data.topartists.artist, function(i, item){

 if(item.image[1]['#text'] == ''){
  art = settings.noart;
 }else{
  art = stripslashes(item.image[imgSize]['#text']);
 }

 url = stripslashes(item.url);
 song = item.name;
 artist = item.playcount['#text'];
 album = item.streamable['#text'];

 $this.append(container);

 var $current = $this.children(':eq('+i+')');

 $current.find('[class=lfm_song]').append(song);
 $current.find('[class=lfm_artist]').append(artist);
 $current.find('[class=lfm_album]').append(album);
 $current.find('[class=lfm_art]').append("<img src='"+art+"' alt='Artwork for "+album+"'/>");
 $current.find('a').attr('href', url).attr('title', 'Listen to '+song+' on Last.FM').attr('target', '_blank');

 //callback
 if(i==(settings.number-1)){
  settings.onComplete.call(this);
 }

  });
 });
});
};

 //Clean up the URL's
 function stripslashes( str ) {  
return (str+'').replace(/\0/g, '0').replace(/\\([\\'"])/g, '$1');
}
})(jQuery);`

Any ideas? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:05:15+00:00Added an answer on May 13, 2026 at 9:05 am

    You have concencated your URL wrong. This is valid:

    var lastUrl = 'http://ws.audioscrobbler.com/2.0/?method=user.gettopartists&user=' + settings.username + '&api_key=' + settings.apikey + '&limit=' + settings.number + '&format=json&callback=?';
    

    I’m not sure it fixes your problem since you didn’t provide enough detail (errors etc).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 301k
  • Answers 301k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Rack as Design Rack middleware is more than "a way… May 13, 2026 at 8:05 pm
  • Editorial Team
    Editorial Team added an answer yes you can, but you can't assign name to it.… May 13, 2026 at 8:05 pm
  • Editorial Team
    Editorial Team added an answer Google Maps API Icon Maker is an open source utility… May 13, 2026 at 8:05 pm

Related Questions

What I am asking, is what is the best way (i.e. the way that
I am trying to write a web widget which will allow users to display
I am trying to write a WSH logon script. Administrators throughout the company need
I am trying to do a couple of things to customize the Visual Studio
I have a C library that needs a callback function to be registered to

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.