dthyresson
getSpotifyTrackUrl
Script
getSpotifyTrackUrl Get a Spotify Track Url using the Spotify Web API given an artist and a song title. Track info is cached by the query and also the spotify track id, so your popular queries won't have to fetch from Spotify over and over. Examples import { getSpotifyTrackUrl } from "https://esm.town/v/dthyresson/getSpotifyTrackUrl";
const reni = await getSpotifyTrackUrl("Stone Roses", "Fools Gold");
const ian = await getSpotifyTrackUrl("Joy Division", "Love Will Tear Us Apart");
const kim = await getSpotifyTrackUrl("Pixies", "Velouria");
console.log(reni)
console.log(ian)
console.log(kim) Info Uses getSpotifyAccessToken which requires you to set environment variables from your Spotify Developers account. SPOTIFY_CLIENT_ID
SPOTIFY_CLIENT_SECRET Your access token is cached by getSpotifyAccessToken to avoid fetching over and over.
0
Updated: July 26, 2024