Skip to content

Commit 1066524

Browse files
authored
Create song.js
1 parent c36e892 commit 1066524

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

song.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
let user = 'spagwhetti';
2+
let url = 'https://lastfm-last-played.biancarosa.com.br/' + user + '/latest-song';
3+
let song = document.querySelector('#song');
4+
fetch(url)
5+
.then(function (response) {
6+
return response.json()
7+
}).then(function (json) {
8+
song.innerHTML = json['track']['name'] + ' - ' + json['track']['artist']['#text'];
9+
});

0 commit comments

Comments
 (0)