Documentation ¶
Index ¶
- Constants
- func ExtractIMDbID(url string) (string, error)
- func FormatIMDbID(id string) (string, error)
- func IsIMDbID(str string) bool
- func IsIMDbURL(str string) bool
- type Movie
- func (m Movie) FormattedDuration() string
- func (m Movie) GetGenresString() string
- func (m Movie) GetSearchQuery(useAltTitle bool) string
- func (m Movie) GetSearchTerms(useAltTitle bool) []string
- func (m Movie) GetTorrent(filters torrents.SearchFilters) (*torrents.Torrent, error)
- func (m Movie) GetTorrents(filters torrents.SearchFilters) ([]torrents.Torrent, error)
- type MovieID
- type OMDBCredentials
Constants ¶
const BaseURL = "https://www.imdb.com"
BaseURL is the base for IMDb URLS.
Variables ¶
This section is empty.
Functions ¶
func ExtractIMDbID ¶
ExtractIMDbID will extract the IMDb ID of a movie from its URL. Assuming that the URL is in the format: https://www.imdb.com/title/tt0848228/
func FormatIMDbID ¶
FormatIMDbID formats the given ID to its canonical 7-digit value.
Types ¶
type Movie ¶
type Movie struct { MovieID Duration int `json:"duration"` Rating float32 `json:"rating"` PosterURL string `json:"poster_url"` Genres []string `json:"genres"` }
Movie holds all the information regarding a movie on IMDb.
func GetMovie ¶
GetMovie will scrape the IMDb page of the movie with the given id and return its details.
func ParseIMDbPage ¶
ParseIMDbPage extracts a movie's details from its IMDb page.
func (Movie) FormattedDuration ¶
FormattedDuration returns the duration of the movie in human-readable format.
func (Movie) GetGenresString ¶ added in v0.15.0
GetGenresString returns the movie's genres as a comma-separated string.
func (Movie) GetSearchQuery ¶ added in v0.14.0
GetSearchQuery returns the string that should be used in the query, when searching for torrents for this movie.
func (Movie) GetSearchTerms ¶ added in v0.14.0
GetSearchTerms returns a list of distinct substrings that should be present in the title of a torrent for this movie.
func (Movie) GetTorrent ¶
GetTorrent will search The Pirate Bay and return the best torrent that complies with the given filters.
func (Movie) GetTorrents ¶
GetTorrents will search The Pirate Bay for torrents of this movie that comply with the given filters. It will return one torrent for each video quality.
type MovieID ¶
type MovieID struct { IMDbID string `json:"imdb_id"` Title string `json:"title"` Year uint `json:"year"` AltTitle string `json:"alt_title"` }
MovieID holds the defining properties of an IMDb movie as they appear in search results.
func ParseSearchPage ¶
ParseSearchPage will parse the result page of an IMDb search and return the titles and IDs of all movies in it.
type OMDBCredentials ¶ added in v0.17.0
type OMDBCredentials struct {
APIKey string `toml:"api_key"`
}
OMDBCredentials holds the API key for access to the OMDB API.
func EnvOMDBCredentials ¶ added in v0.17.0
func EnvOMDBCredentials() OMDBCredentials
EnvOMDBCredentials returns an OMDBCredentials struct variable which contains the credentials found in the TVDB_API_KEY.
func (*OMDBCredentials) GetMovie ¶ added in v0.17.0
func (omdb *OMDBCredentials) GetMovie(imdbID string) (*Movie, error)
GetMovie fetches a movie using the OMDB API.
func (*OMDBCredentials) IsEnabled ¶ added in v0.17.0
func (omdb *OMDBCredentials) IsEnabled() bool
IsEnabled returns true if an API key has been provided for the OMDb API.