Skip to content

A Go library for accessing the iTunes Search API

Notifications You must be signed in to change notification settings

imkh/go-itunes-search

Repository files navigation

go-itunes-search

A Go library for accessing the iTunes Search API. Inspired by go-gitlab.

Coverage

Movie

  • Search and look up movie artists
  • Search and look up movies

Podcast

  • Search and look up podcast authors
  • Search and look up podcasts

Music

  • 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

Audiobook

  • Search and look up audiobook authors
  • Search and look up audiobooks

Short Film

  • Search and look up short film artists
  • Search and look up short films

TV Show

  • Search and look up TV show episodes
  • Search and look up TV show seasons

Software

  • 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

Ebook

  • Search and look up ebook authors
  • Search and look up ebooks

Installation

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"

Usage

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

About

A Go library for accessing the iTunes Search API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages