/spotify

Go library for the Spotify Web API and Accounts service

Primary LanguageGoApache License 2.0Apache-2.0

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