A Go library for accessing the iTunes Search API. Inspired by go-gitlab.
- Search and look up movie artists
- Search and look up movies
- Search and look up podcast authors
- Search and look up podcasts
- Search and look up music artists
- Search and look up music tracks
- Search and look up albums
- Search and look up music videos
- Search and look up mixes
- Search and look up songs
- Search and look up audiobook authors
- Search and look up audiobooks
- Search and look up short film artists
- Search and look up short films
- Search and look up TV show episodes
- Search and look up TV show seasons
- Search and look up software developers
- Search and look up software
- Search and look up iPad software
- Search and look up Mac software
- Search and look up TV software
- Search and look up ebook authors
- Search and look up ebooks
Inside your project directory, run:
$ go get github.com/imkh/go-itunes-search
or import the module and run go get
without parameters.
import "github.com/imkh/go-itunes-search"
package main
import (
"github.com/imkh/go-itunes-search"
)
func main() {
client, err := itunes.NewClient()
if err != nil {
log.Fatalf("Failed to create client: %v", err)
}
// Search movies
term := "spider-man"
searchOpts := &itunes.SearchOptions{
Country: itunes.Country(itunes.UnitedStates),
}
movies, _, err := client.Movie.SearchMovies(term, searchOpts)
if err != nil {
log.Fatal(err)
}
fmt.Printf("Search movies %q (%d results)\n", term, len(movies))
for _, movie := range movies {
fmt.Printf(" %s (%d)\n", movie.TrackName, movie.ReleaseDate.Year())
}
fmt.Println()
// Look up albums
id := "1548835870"
lookupOpts := &itunes.LookupOptions{
Country: itunes.Country(itunes.Japan),
Lang: itunes.Language(itunes.English),
}
albums, _, err := client.Music.LookupAlbums(&id, nil, nil, lookupOpts)
if err != nil {
log.Fatal(err)
}
fmt.Printf("Look up albums %q (%d results)\n", id, len(albums))
for _, album := range albums {
fmt.Printf(" %s / %s (%d)\n", album.CollectionName, album.ArtistName, album.ReleaseDate.Year())
}
}