Search for lyrics or samples for currently playing spotify song

Oct-08-2022 13-36-08

After using and playing around with @jacopo-degattis' spotify-playing, I came up this quick and simple way to look up lyrics and samples (and maybe more?) for the song that's currently playing in spotify.

I plan on adding some basic feedback on errors and probably an option for manual search input. Contributions and suggestions always welcome!


Open spotify-searches in Script Kit

// Name: Search current song
// Description: Search the currently playing spotify song for lyrics or samples
// Author: Mariano Amado
import "@johnlindquist/kit"
const spotify = await npm("spotify-node-applescript")
spotify.isRunning((err, isRunning) => {
if (!isRunning) return exit();
spotify.getTrack(async (err: any, track: any) => {
if (err) return exit();
const { artist, name } = track;
const term = `${artist}+${name}`.replace("&", "");
const site = await arg(`${name} - ${artist}`, [
{
name: "Genius.com",
description: 'Search for song lyrics',
value: 'genius',
},
{
name: "Whosampled.com",
description: 'Search for samples',
value: 'whosampled',
},
])
const uri = encodeURI(`https://www.${site}.com/search?q=${term}`)
exec(`open '${uri}'`)
})
})