Skip to content

Go library for the Spotify Web API and Accounts service

License

Notifications You must be signed in to change notification settings

brianstrauch/spotify

Repository files navigation

Spotify Go Library

Description

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

Download

go get github.com/brianstrauch/spotify

Usage

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)
}