A Go library for the Spotify Web API and Accounts service.
- Authorize an application, with or without PKCE
- Get currently playing music or podcast
- Search for specific songs by name
- Save music to user's library
go get github.com/brianstrauch/spotify
import (
"fmt"
"github.com/brianstrauch/spotify"
)
const token = "<YOUR API TOKEN>"
func main() {
api := spotify.NewAPI(token)
if err := api.Play(); err != nil {
panic(err)
}
playback, err := api.GetPlayback()
if err != nil {
panic(err)
}
fmt.Printf("Playing %s\n", playback.Item.Name)
}