• Townie
    AI
  • Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
dthyresson

dthyresson

getSpotifyTrackUrl

Public
Like
getSpotifyTrackUrl
Home
Code
2
README.md
main.tsx
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
7/26/2024
Viewing readonly version of main branch: v143
View latest version
README.md

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

Create val
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.

Migrated from folder: Spotify/getSpotifyTrackUrl

FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.