Documentation
¶
Overview ¶
Package imdb implements IMDb web API.
All operations require an http client such as:
client := http.DefaultClient
To search a title:
results, err := imdb.SearchTitle(client, "matrix") ...
results is a slice of imdb.Title results with basic information (Name, URL, Year).
To get detailed information on a title:
title, err := imdb.NewTitle(client, "tt0133093") ...
Actors, Rating, Description and other fields are available.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrInvalidID = errors.New("imdb: invalid ID")
)
Generic errors.
Functions ¶
This section is empty.
Types ¶
type Episode ¶
type Episode struct { ID string `json:"id"` Type string `json:"type"` Season string `json:"season"` Episode string `json:"episode"` TitleText string `json:"titleText"` ReleaseDate ReleaseDate `json:"releaseDate"` ReleaseYear int `json:"releaseYear"` Image Image `json:"image"` Plot string `json:"plot"` AggregateRating float64 `json:"aggregateRating"` VoteCount int `json:"voteCount"` CanRate bool `json:"canRate"` ContributionUrl string `json:"ContributionUrl"` }
Episode represents a single episode from a TV series.
type ErrParse ¶
type ErrParse struct {
// contains filtered or unexported fields
}
An ErrParse represents a parsing error. It implements error interface.
func NewErrParse ¶
NewErrParse creates a parsing error with details.
type Media ¶
type Media struct { ID string `json:",omitempty"` TitleID string `json:",omitempty"` URL string `json:",omitempty"` ContentURL string `json:",omitempty"` }
A Media represents an IMDb media (poster, photos, etc.). It references to a Title by its ID.
type Name ¶
type Name struct { ID string `json:",omitempty"` URL string `json:",omitempty"` FullName string `json:",omitempty"` }
A Name represents an IMDb name (actor, director, writer, etc.).
type ReleaseDate ¶
type SearchQueryResponse ¶
type SearchQueryResponse struct { Matches []struct { Image struct { Height int `json:"height"` ImageURL string `json:"imageUrl"` Width int `json:"width"` } `json:"i"` ID string `json:"id"` Title string `json:"l"` MainActors string `json:"s"` Q string `json:"q,omitempty"` Type string `json:"qid,omitempty"` Rank int `json:"rank,omitempty"` Year int `json:"y,omitempty"` YearInProduction string `json:"yr,omitempty"` } `json:"d"` Query string `json:"q"` V int `json:"v"` }
SearchQueryResponse represents the JSON struct returned by a query on searchURL
type Season ¶
type Season struct { Episodes []Episode `json:"items"` Total int `json:"total"` HasNextPage bool `json:"hasNextPage"` EndCursor string `json:"endCursor"` HasRatedEpisode bool `json:"hasRatedEpisode"` }
Season represents a season from a TV Series, with a list of episodes.
type Title ¶
type Title struct { ID string `json:",omitempty"` URL string `json:",omitempty"` ParentID string `json:",omitempty"` Name string `json:",omitempty"` Type string `json:",omitempty"` Year int `json:",omitempty"` Rating string `json:",omitempty"` RatingCount int `json:",omitempty"` Duration string `json:",omitempty"` Directors []Name `json:",omitempty"` Writers []Name `json:",omitempty"` Actors []Name `json:",omitempty"` Genres []string `json:",omitempty"` Languages []string `json:",omitempty"` Nationalities []string `json:",omitempty"` Description string `json:",omitempty"` Poster Media `json:",omitempty"` SeasonCount int `json:",omitempty"` Season int `json:",omitempty"` Episode int `json:",omitempty"` }
A Title represents an IMDb title (movie, series, etc.).
func SearchTitle ¶
SearchTitle searches for titles matching name and returns partial Titles. A partial Title has only ID, URL, Name and Year set. A full Title can be obtained with NewTitle, at the cost of extra requests.