MCPcopy Create free account
hub / github.com/AyushSaini00/60minuteJavaScript / getSong

Function getSong

Code-Music/app.js:15–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13};
14
15function getSong(){
16 fetch(api)
17 .then(response => {
18 return response.json();
19 })
20 .then(data => {
21 console.log(data);
22 song.title = data.now_playing.song.title;
23 song.artist = data.now_playing.song.artist;
24
25 song.bitrate.high = data.station.mounts[0].bitrate;
26 song.url.high = data.station.mounts[0].url;
27
28 song.bitrate.low = data.station.mounts[1].bitrate;
29 song.url.low = data.station.mounts[1].url;
30 })
31 .then(() => {
32 displayInfo();
33 })
34 .catch(error =>{
35 songTitleElement.innerText = error.message;
36 });
37}
38
39function displayInfo(){
40 songTitleElement.innerText = song.title;

Callers 1

app.jsFile · 0.85

Calls 1

displayInfoFunction · 0.85

Tested by

no test coverage detected