-
Notifications
You must be signed in to change notification settings - Fork 0
/
examples.html
63 lines (37 loc) · 1.93 KB
/
examples.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!DOCTYPE HTML>
<html>
<head>
<title>EchoNest JavaScript API</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.4.js" type="text/javascript"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js" type="text/javascript"></script>
<script src="js/jquery.echonest.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
var echonest = new EchoNest("KTY7T5L87IZ1OG2TM");
// get the second Radiohead biography by artist id and output it onto the page, also output the site it came from and the license used. Nested items are available through a prefix. E.g.
// get a set of "Radiohead" artist images and output as a bunch of images to the page (limited to first five results)
echonest.artist("Drake").images(function(imageCollection) {
$('#artistImages').append(imageCollection.to_html('<img src="${url}" style="height:100px;width:100px">') );
}, {results: 1});
// what terms are used to descript the artist David Bowie?
echonest.artist("Drake").terms( function(termsCollection) {
termys = termsCollection.data.terms[0].name+", "+termsCollection.data.terms[1].name+", "+termsCollection.data.terms[2].name;
var termsDiv=$(document.createElement('div'));
$(termsDiv).html(termys);
$('#artistTerms').append(termsDiv);
});
});
</script>
</head>
<body>
<h1>EchoNest JavaScript API Examples</h1>
<p>A set of examples for interacting with the EchoNest API</p>
<h3>Biographies of "Drake"</h3>
<div id="artistBiography"></div>
<h3>Images of "Drake"</h3>
<div id="artistImages"></div>
<h3>Terms Used to Describe "Drake"</h3>
<div id="artistTerms"></div>
</body>
</html>