go-imdb: bitbucket.org/chrj/go-imdb Index | Examples | Files

package imdb

import "bitbucket.org/chrj/go-imdb"

Package imdb implements IMDB lookups using the omdbapi.com API

For more information on the different parameters, refer to http://www.omdbapi.com

Index

Examples

Package Files

imdb.go

type ImdbResult Uses

type ImdbResult struct {

    // Was a title found
    Found bool

    Title      string
    Year       string
    Rated      string
    Released   string
    Runtime    string
    Genre      string
    Director   string
    Writer     string
    Actors     string
    Plot       string
    Language   string
    Country    string
    Awards     string
    Metascore  string
    ImdbRating string `json:"imdbRating"`
    ImdbVotes  string `json:"imdbVotes"`
    ImdbID     string `json:"imdbID"`
    Type       string
    Poster     string

    TomatoMeter       string `json:"tomatoMeter"`
    TomatoImage       string `json:"tomatoImage"`
    TomatoRating      string `json:"tomatoRating"`
    TomatoReviews     string `json:"tomatoReviews"`
    TomatoFresh       string `json:"tomatoFresh"`
    TomatoRotten      string `json:"tomatoRotten"`
    TomatoConsensus   string `json:"tomatoConsensus"`
    TomatoUserMeter   string `json:"tomatoUserMeter"`
    TomatoUserRating  string `json:"tomatoUserRating"`
    TomatoUserReviews string `json:"tomatoUserReviews"`
}

func Lookup Uses

func Lookup(params map[string]string) (*ImdbResult, error)

Lookup a title

Expected params:

t: Title
y: Year
i: ID
plot: "short" or "full" (default: "short")

Using the generic Lookup function

Code:

res, err := Lookup(map[string]string{
    "t": "Spring Breakers",
    "y": "2012",
})

if err != nil {
    log.Fatalf("Error: %s\n", err)
}

fmt.Printf("%s (%s) starring: %s\n", res.Title, res.Year, res.Actors)

func LookupId Uses

func LookupId(id string) (*ImdbResult, error)

Lookup by IMDB ID (e.g. "tt2101441")

Using the LookupId function

Code:

res, err := LookupId("tt2101441")

if err != nil {
    log.Fatalf("Error: %s\n", err)
}

fmt.Printf("%s (%s) starring: %s\n", res.Title, res.Year, res.Actors)

func LookupTitle Uses

func LookupTitle(title string) (*ImdbResult, error)

Lookup by title (e.g. "Spring Breakers")

Using the LookupTitle function

Code:

res, err := LookupTitle("Spring Breakers")

if err != nil {
    log.Fatalf("Error: %s\n", err)
}

fmt.Printf("%s (%s) starring: %s\n", res.Title, res.Year, res.Actors)

func (*ImdbResult) Url Uses

func (res *ImdbResult) Url() string

URL for the result at imdb.com

type ImdbSearchItem Uses

type ImdbSearchItem struct {
    Title  string
    Year   string
    ImdbID string `json:"imdbID"`
    Type   string
}

func (*ImdbSearchItem) Lookup Uses

func (res *ImdbSearchItem) Lookup() (*ImdbResult, error)

Lookup this item

type ImdbSearchResult Uses

type ImdbSearchResult struct {
    Search []ImdbSearchItem
}
func Search(params map[string]string) (*ImdbSearchResult, error)

Search for a title

Expected params:

s: Search query
y: Year

func (*ImdbSearchResult) Count Uses

func (res *ImdbSearchResult) Count() int

How many titles are in the results

Package imdb imports 6 packages (graph). Updated 2019-04-27. Refresh now. Tools for package owners.