Documentation ¶
Overview ¶
Package imdb is a simple imdb client.
Index ¶
- Variables
- type Client
- func (cl *Client) Find(ctx context.Context, q string, params ...string) ([]Result, error)
- func (cl *Client) FindCompany(ctx context.Context, company string, params ...string) ([]Result, error)
- func (cl *Client) FindEpisode(ctx context.Context, episode string, params ...string) ([]Result, error)
- func (cl *Client) FindGame(ctx context.Context, game string, params ...string) ([]Result, error)
- func (cl *Client) FindKeyword(ctx context.Context, keyword string, params ...string) ([]Result, error)
- func (cl *Client) FindMovie(ctx context.Context, movie string, params ...string) ([]Result, error)
- func (cl *Client) FindName(ctx context.Context, name string, params ...string) ([]Result, error)
- func (cl *Client) FindSeries(ctx context.Context, series string, params ...string) ([]Result, error)
- func (cl *Client) FindTitle(ctx context.Context, title string, params ...string) ([]Result, error)
- func (cl *Client) FindTitleSubtype(ctx context.Context, subtype Subtype, title string, params ...string) ([]Result, error)
- func (cl *Client) FindType(ctx context.Context, typ Type, q string, params ...string) ([]Result, error)
- type Option
- type Result
- func Find(ctx context.Context, q string, opts ...Option) ([]Result, error)
- func FindCompany(ctx context.Context, company string, opts ...Option) ([]Result, error)
- func FindEpisode(ctx context.Context, episode string, opts ...Option) ([]Result, error)
- func FindGame(ctx context.Context, game string, opts ...Option) ([]Result, error)
- func FindKeyword(ctx context.Context, keyword string, opts ...Option) ([]Result, error)
- func FindMovie(ctx context.Context, movie string, opts ...Option) ([]Result, error)
- func FindName(ctx context.Context, name string, opts ...Option) ([]Result, error)
- func FindSeries(ctx context.Context, series string, opts ...Option) ([]Result, error)
- func FindTitle(ctx context.Context, title string, opts ...Option) ([]Result, error)
- func FindTitleSubtype(ctx context.Context, subtype Subtype, title string, opts ...Option) ([]Result, error)
- func FindType(ctx context.Context, typ Type, q string, opts ...Option) ([]Result, error)
- type Subtype
- type Type
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultTransport = http.DefaultTransport
DefaultTransport is the default http transport.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Transport http.RoundTripper UserAgent string AppCacheDir string // contains filtered or unexported fields }
Client is a imdb client.
func New ¶
New creates a new imdb client.
Example (FindTitle) ¶
package main import ( "context" "fmt" "github.com/kenshaw/imdb" ) func main() { cl := imdb.New() res, err := cl.FindTitle(context.Background(), "luca") if err != nil { panic(err) } if len(res) == 0 { fmt.Println("expected at least one result") return } fmt.Printf("result: %s\n", res[0]) }
Output: result: tt12801262: "Luca" (movie, 2021) https://www.imdb.com/title/tt12801262/
func (*Client) FindCompany ¶
func (cl *Client) FindCompany(ctx context.Context, company string, params ...string) ([]Result, error)
FindCompany searches for a company.
func (*Client) FindEpisode ¶
func (cl *Client) FindEpisode(ctx context.Context, episode string, params ...string) ([]Result, error)
FindEpisode searches for a episode.
func (*Client) FindKeyword ¶
func (cl *Client) FindKeyword(ctx context.Context, keyword string, params ...string) ([]Result, error)
FindKeyword searches for a keyword.
func (*Client) FindSeries ¶
func (cl *Client) FindSeries(ctx context.Context, series string, params ...string) ([]Result, error)
FindSeries searches for a series.
type Option ¶
type Option func(*Client)
Option is a imdb client option.
func WithAppCacheDir ¶
WithAppCacheDir is a imdb client option to set the app cache dir.
func WithLogf ¶
WithLogf is a imdb client option to set a log handler for http requests and responses.
func WithTransport ¶
func WithTransport(transport http.RoundTripper) Option
WithTransport is a imdb client option to set the http transport.
type Result ¶
Result is the result of a search.
func FindCompany ¶
FindCompany searches for a company.
func FindEpisode ¶
FindEpisode searches for a episode.
func FindKeyword ¶
FindKeyword searches for a keyword.
func FindSeries ¶
FindSeries searches for a series.
func FindTitleSubtype ¶ added in v0.1.9
func FindTitleSubtype(ctx context.Context, subtype Subtype, title string, opts ...Option) ([]Result, error)
FindTitleSubtype searches for subtype with title.
type Subtype ¶ added in v0.3.2
type Subtype string
Subtype is a subtype.