1
2
3
4
5
6
7
8
9
10
11
import LastFm from "npm:lastfm-node-client";
const lastFm = new LastFm(Deno.env.get("LASTFM_API_KEY"));
const data = await lastFm.userGetRecentTracks({
user: "elias-jackson2",
});
const mostRecentTrack = data.recenttracks.track[0];
const nowPlaying = mostRecentTrack["@attr"].nowplaying === "true";
console.log(
`${mostRecentTrack.artist["#text"]} - ${mostRecentTrack.name} (Now playing = ${nowPlaying ? "True" : "False"})`,
);
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
May 22, 2024