mirror of
https://github.com/catmpeg/catmpeg.github.io.git
synced 2026-02-20 15:50:57 +03:00
Update lastplayed.js
This commit is contained in:
parent
25bab75312
commit
3801de8043
1 changed files with 4 additions and 4 deletions
|
|
@ -1,13 +1,13 @@
|
||||||
document.addEventListener("DOMContentLoaded", () => {
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
const lastPlayedBlock = document.getElementById('last-played');
|
const lastPlayedBlock = document.getElementById('last-played');
|
||||||
|
|
||||||
fetch("https://lastfm-last-played.biancarosa.com.br/catmpeg/latest-song")
|
fetch("https://cat.fs.tlpteam.ru:5011/?user=catmpeg")
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
if (data != 0) {
|
if (data && data.name) {
|
||||||
const lastPlayed = document.getElementById("song");
|
const lastPlayed = document.getElementById("song");
|
||||||
lastPlayed.innerHTML = `<a target="_blank" href="${data.track.url}">
|
lastPlayed.innerHTML = `<a target="_blank" href="${data.url}">
|
||||||
${data.track.name} - ${data.track.artist["#text"]}</a>`;
|
${data.name} - ${data.artist}</a>`;
|
||||||
lastPlayedBlock.style.display = "block";
|
lastPlayedBlock.style.display = "block";
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue