Using AppleScript to add Spotify's current song to a playlist

Is there an AppleScript that can add the current Spotify track to a playlist with a system shortcut? Looking for a concise solution.

yea, i’ve done this before! u can use applescript to grab the current track info from spotify and add it to a playlist. it’s pretty straightforward, but you’ll need to mess with the spotify api a bit. lemme know if u want more details on the script

I recently faced a similar situation and managed to build a solution that combines AppleScript with shell scripting and the Spotify API. My approach involved configuring API credentials and handling token refresh, which turned out to be the most challenging part of the implementation. I avoided hardcoding any values by reading parameters from a configuration file. The AppleScript was responsible for fetching the current track details from Spotify, while the shell script handled the API call to add the track to the designated playlist. Once set up, the complete process, triggered by a system shortcut, ran reliably. If you plan to recreate this, ensure your token management is robust and consider error handling to cover any API inconsistencies.