public
Created

Top hotttest Twitter artists

  • Download Gist
TopTwitter.html
HTML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
<!DOCTYPE html>
<html>
<head>
<title>Top Twitter</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<link type="text/css" href="styles.css" rel="stylesheet" />
</head>
<body>
<h1 id='title'> Top 100 artists with verified Twitter accounts</h1>
<ol id="results"> </ol>
<div id="footer"> Powered by <a href="http:/developer.echonest.com">The Echo nest </a></div>
</body>
 
<script type="text/javascript">
function fetchTopTwitterArtists() {
var url = 'http://developer.echonest.com/api/v4/artist/top_hottt?callback=?';
 
$.getJSON(url, { 'api_key': 'N6E4NIOVYMTHNDM8J', 'format':'jsonp',
'results': 100, 'bucket': ['hotttnesss', 'id:twitter'], 'limit': true}, function(data) {
for (var i = 0; i < data.response.artists.length; i++) {
var artist = data.response.artists[i];
var elem = $("<li>");
var link = $("<a>");
var handle = artist.foreign_ids[0].foreign_id.replace('twitter:artist:', '');
link.attr('href', 'http://twitter.com/' + handle);
link.text(artist.name);
elem.append(link);
$("#results").append(elem);
}
});
}
 
$(document).ready(function() {
jQuery.ajaxSettings.traditional = true;
fetchTopTwitterArtists();
});
 
</script>
</html>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.