mirror of
https://github.com/zyqunix/tools.git
synced 2025-07-05 22:10:31 +02:00
fixes
This commit is contained in:
parent
13de9931b0
commit
75a96b576c
3 changed files with 8 additions and 2 deletions
|
@ -211,6 +211,7 @@ function fetchSong() {
|
|||
fetch(url)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
console.log(data);
|
||||
const track = data?.recenttracks?.track?.[0];
|
||||
if (!track) return;
|
||||
const artist = track.artist["#text"];
|
||||
|
@ -218,6 +219,7 @@ function fetchSong() {
|
|||
const image = track.image.find(img => img.size === "extralarge")?.["#text"] || "";
|
||||
|
||||
document.getElementById("artist").innerText = artist;
|
||||
document.getElementById("artist").href = `https://duckduckgo.com/?q=${artist}`;
|
||||
document.getElementById("song-name").innerText = title;
|
||||
document.getElementById("song-cover").src = !image ? "https://lastfm.freetls.fastly.net/i/u/64s/4128a6eb29f94943c9d206c08e625904.jpg" : image;
|
||||
document.getElementById("song-url").href = track.url;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue