Build a now-playing widget
Given an artist name and a track title, fetch the metadata, cover art and lyrics so you can render a now-playing card.
Step 1: Resolve the track
JavaScript
const headers = { 'User-Agent': '[email protected]' };
const track = await fetch(
'https://api.synkradio.co.uk/track/info?artist=Daft%20Punk&title=Around%20the%20World',
{ headers }
).then((r) => r.json());The response contains the canonical title, the ISRC, duration and a stable id. Keep the ISRC, it makes follow-up calls cheaper.
Step 2: Fetch artwork and lyrics in parallel
JavaScript
const [cover, lyrics] = await Promise.all([
fetch(`https://api.synkradio.co.uk/cover?artist=${encodeURIComponent(track.artist)}&title=${encodeURIComponent(track.title)}`, { headers }),
fetch(`https://api.synkradio.co.uk/lyrics?isrc=${track.isrc}`, { headers }).then((r) => r.json())
]);/cover returns the image directly, so pipe cover.body straight to your CDN or <img src>. /lyrics returns synced lyrics when available, falling back to plain text.
Cache the ISRC
Once you have the ISRC, subsequent requests should skip /track/info entirely. Pass isrc= to any endpoint that accepts it and the API will skip the lookup.
Step 3: Render
That is everything you need. Title, artist, cover URL and lyrics. Total round trips: two if you already had the ISRC, three otherwise.