1
我已經可以從我的Spotify帳戶獲取上次播放曲目的曲目和藝術家。代碼:使用Last.fm獲取圖像API
$.getJSON("http://ws.audioscrobbler.com/2.0/?method=user.getRecentTracks&user=xxxxxx&api_key=xxxxxxxxx&limit=2&nowplaying=false&format=json&callback=?", function(data) {
var html = '';
var counter = 1;
$.each(data.recenttracks.track, function(i, item) {
if(counter == 1) {
html += '<span>' + item.name + '<br /> ' + item.artist['#text'] + '</span>' + item.image;
}
counter++
});
$('.listening-to').append(html);
});
但item.image產生:
undefined
不要高呼,不要回答! – SFDSF