-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
26 lines (24 loc) · 940 Bytes
/
index.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
<html>
<head>
</head>
<body>
<div id="lastfm-widget">
<div id="widget">🎧 <span id="song">⌛</span></div>
<div>
<p><small>latest played song on <a href="http://last.fm" target="_blank">last.fm</a></small></p>
<p><small>powered by <a href="https://github.com/biancarosa/lastfm-last-played"
target="_blank">@biancarosa/lastfm-last-played</a></small></p>
</div>
</div>
<script type="text/javascript">
let user = 'biahll';
let url = 'https://lastfm-last-played.biancarosa.com.br/' + user + '/latest-song';
let song = document.querySelector('#song');
fetch(url)
.then(function (response) {
return response.json()
}).then(function (json) {
song.innerHTML = json['track']['name'] + ' - ' + json['track']['artist']['#text'];
});
</script>
</body>