Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/blixt/go-spotify
Simple Go library for the Spotify API
https://github.com/blixt/go-spotify
Last synced: about 1 month ago
JSON representation
Simple Go library for the Spotify API
- Host: GitHub
- URL: https://github.com/blixt/go-spotify
- Owner: blixt
- Created: 2012-08-25T19:14:10.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2012-08-25T19:15:05.000Z (about 12 years ago)
- Last Synced: 2024-04-21T10:12:33.966Z (7 months ago)
- Language: Go
- Size: 89.8 KB
- Stars: 2
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Go Spotify
This is a simple module to communicate with the Spotify API.
**Note:** This is library is currently very simple and only supports a few
requests.## Installation
go get github.com/blixt/go-spotify/spotify
## Examples
### Perform parallel search queries
package main
import (
"fmt"
"github.com/blixt/go-spotify/spotify"
)
func main() {
api := spotify.GetApi()
queries := make(chan *spotify.SearchTrackQuery)
// Make two search queries in parallel.
go api.SearchTrack("never gonna give you up", queries)
go api.SearchTrack("trololo", queries)
// Print the first track of each query result.
for i := 0; i < 2; i++ {
query := <-queries
fmt.Printf("Got %d results for \"%s\". First result:\n", query.Info.NumResults, query.Query)
track := query.Tracks[0]
fmt.Println(track.Href, track.Name, "by", track.Artists[0].Name)
}
}