Documentation ¶
Index ¶
- Constants
- Variables
- type Episode
- type ErrBadDateFormat
- type ErrEpisodeTitle
- type ErrInvalidImdbCode
- type ErrInvalidQuery
- type ErrRedirect
- type ErrTitleNotFound
- type FilmingLocation
- type IMDBPie
- func (m *IMDBPie) ExcludeEpisodes(s bool)
- func (m *IMDBPie) GetName(imdbid string) (nmD NameDetailed, err error)
- func (m *IMDBPie) GetTitle(imdbid string) (Title, error)
- func (m *IMDBPie) SearchName(tName string) ([]SingleSearchNameResult, error)
- func (m *IMDBPie) SearchTitle(tName string, tYear int) ([]SingleSearchTitleResult, error)
- func (m *IMDBPie) SetRegion(r string)
- type Image
- type ImageBasic
- type ImageDetail
- type NameBasic
- type NameDetailed
- type People
- type PersonName
- type PlotSummary
- type Rating
- type SingleCredit
- type SingleEpisode
- type SingleSearchNameResult
- type SingleSearchTitleResult
- type SingleSeason
- type SingleVersion
- type Size
- type SoundTrack
- type T
- type Title
- func (t *Title) GetTitleCredits() (crds map[string][]SingleCredit, err error)
- func (t *Title) GetTitleEpisodes() ([]SingleSeason, error)
- func (t *Title) GetTitleGenres() ([]string, error)
- func (t *Title) GetTitleImages() (imgs []ImageDetail, err error)
- func (t *Title) GetTitleVersions() (vr VersionInfo, err error)
- type Title1
- type TitleBasic
- type TitleEpisodes
- type TitleMinimal
- type TitleRelease
- type TitleReleases
- type VersionInfo
Constants ¶
const ( BaseUri = "https://api.imdbws.com" SearchBaseUri = `https://v2.sg.media-imdb.com` UserAgent = `IMDb/8.3.1 (iPhone9,4; iOS 11.2.1)` AppKey = `76a6cc20-6073-4290-8a2c-951b4580ae4a` SoonExpire = time.Minute * 5 ServiceName = "imdbapi" ServiceRegion = "us-east-1" )
holds various constants used in the program
Variables ¶
var ERROR_NO_EPISODES_FOR_TITLE = errors.New("title is not a tvSeries so can't get episodes")
var ERROR_NO_NAME_DATA = errors.New("name has no api data, please call getName prior to calling its methods")
var ERROR_NO_TITLE_DATA = errors.New("title has no api data, please call get title prior to calling its methods")
error messages
var RegexImdbExtract = regexp.MustCompile(`((?:tt|nm)\d{5,8})(?:$|\D)`)
var RegexImdbID = regexp.MustCompile(`^(tt|nm)\d{5,8}$`)
var RegexImdbName = regexp.MustCompile(`^nm\d{5,8}$`)
var RegexImdbTitle = regexp.MustCompile(`^tt\d{5,8}$`)
Functions ¶
This section is empty.
Types ¶
type ErrBadDateFormat ¶
type ErrBadDateFormat struct {
// contains filtered or unexported fields
}
func (ErrBadDateFormat) Error ¶
func (e ErrBadDateFormat) Error() string
type ErrEpisodeTitle ¶
type ErrEpisodeTitle struct {
// contains filtered or unexported fields
}
func (ErrEpisodeTitle) Error ¶
func (e ErrEpisodeTitle) Error() string
type ErrInvalidImdbCode ¶
type ErrInvalidImdbCode struct {
// contains filtered or unexported fields
}
ErrInvalidImdbCode - bad imdb code (must be tt....)
func (ErrInvalidImdbCode) Error ¶
func (e ErrInvalidImdbCode) Error() string
type ErrInvalidQuery ¶
type ErrInvalidQuery struct {
// contains filtered or unexported fields
}
func (ErrInvalidQuery) Error ¶
func (e ErrInvalidQuery) Error() string
type ErrRedirect ¶
type ErrRedirect struct {
// contains filtered or unexported fields
}
func (ErrRedirect) Error ¶
func (e ErrRedirect) Error() string
type ErrTitleNotFound ¶
type ErrTitleNotFound struct {
// contains filtered or unexported fields
}
func (ErrTitleNotFound) Error ¶
func (e ErrTitleNotFound) Error() string
type FilmingLocation ¶
type FilmingLocation struct { Attributes []string `json:"attributes,omitempty"` // where (i.e. inside, outside) Comment string `json:"comment,omitempty"` // additional info Location string `json:"location,omitempty"` // location mame }
FilmingLocation a single Film Location
type IMDBPie ¶
type IMDBPie struct {
// contains filtered or unexported fields
}
IMDBPie - contain information about the parameters of the package. No exposed fields
func InitIMDBPie ¶
func InitIMDBPie() *IMDBPie
InitIMDBPie - create the api structure that allows the searchs.
func (*IMDBPie) ExcludeEpisodes ¶
ExcludeEpisodes - set a flag to exclude the episodes from the result sets (use if you don't need such details)
func (*IMDBPie) GetName ¶
func (m *IMDBPie) GetName(imdbid string) (nmD NameDetailed, err error)
GetName - Get Info on a Name by its ID.
func (*IMDBPie) GetTitle ¶
GetTitle - Get Basic Info on a title (and film locations, soundtracks) using a single api call the call also check for a valid ttxxxxxx id code and that this id is not redirected to a new one
func (*IMDBPie) SearchName ¶
func (m *IMDBPie) SearchName(tName string) ([]SingleSearchNameResult, error)
SerachName - search IMDB for a name result. Only name results will be returned.
func (*IMDBPie) SearchTitle ¶
func (m *IMDBPie) SearchTitle(tName string, tYear int) ([]SingleSearchTitleResult, error)
SearchTitle - search IMDB for the title with an optional year (which is just added as a string to the search). note, non title results will not be returned. (use Name search to search for people)
type ImageBasic ¶
ImageBasic Basic image data - contain the URL and the size
type ImageDetail ¶
type ImageDetail struct { ImageBasic `json:"imageBasic"` Caption string `json:"caption,omitempty"` CreatedOn time.Time `json:"createdOn"` Copyright string `json:"copyright,omitempty"` Attribution string `json:"attribution,omitempty"` Source string `json:"source,omitempty"` Type string `json:"type,omitempty"` }
ImageDetail Image with more details (as getting it from the image api)
type NameBasic ¶
type NameBasic struct { ID string `json:"ID,omitempty"` Akas []string `json:"akas,omitempty"` Image ImageBasic `json:"image"` Name string `json:"name,omitempty"` LegacyName string `json:"legacyName,omitempty"` }
NameBasic Basic Name / person information
type NameDetailed ¶
type NameDetailed struct { NameBasic BirthDate string `json:"birthDate"` BirthPlace string `json:"birthPlace"` Gender string `json:"gender"` HeightCentimeters float64 `json:"heightCentimeters"` MiniBios []struct { Author string `json:"author"` //ID string `json:"id"` Language string `json:"language"` Text string `json:"text"` } `json:"miniBios"` Nicknames []string `json:"nicknames"` RealName string `json:"realName"` Spouses []struct { Attributes string `json:"attributes"` FromDate string `json:"fromDate"` Name string `json:"name"` ToDate string `json:"toDate"` } `json:"spouses"` Jobs []string `json:"jobs"` // contains filtered or unexported fields }
NameDetailed detailed name (I excluded known-for items) seems too much info
type PersonName ¶
type PlotSummary ¶
type PlotSummary struct { Author string `json:"author,omitempty"` PlotSummary string `json:"PlotSummary,omitempty"` }
PlotSummary a single Plot Summary
type SingleCredit ¶
type SingleCredit struct { ID string `json:"ID,omitempty"` Name string `json:"name,omitempty"` Category string `json:"category,omitempty"` Image `json:"image"` Akas []string `json:"akas,omitempty"` Job string `json:"job,omitempty"` LegacyName string `json:"legacyName,omitempty"` }
SingleCredit a single credit for a person in a title
type SingleEpisode ¶
type SingleEpisode struct { ID string `json:"id"` Season int `json:"season"` Episode int `json:"episode"` Title string `json:"title"` TitleType string `json:"titleType"` Year int `json:"year"` }
SingleEpisode single episode info
type SingleSearchNameResult ¶
type SingleSearchNameResult struct { Image ImageBasic `json:"image"` // imageData ID string `json:"ID"` // imdb ID Name string `json:"name,omitempty"` //title KnownFor string `json:"knownFor,omitempty"` //top names }
SingleSearchNameResult a single result when searching for a name
type SingleSearchTitleResult ¶
type SingleSearchTitleResult struct { Image ImageBasic `json:"image"` // imageData ID string `json:"ID"` // imdb ID Title string `json:"title,omitempty"` //title TypeName string `json:"typeName,omitempty"` TypeCode string `json:"typeCode,omitempty"` TopCast []string `json:"topCast,omitempty"` //top names Year int `json:"year,omitempty"` // year out Years string `json:"years,omitempty"` // year range if multiple years }
SingleSearchTitleResult a single result when searching for a title
type SingleSeason ¶
type SingleSeason struct { Season int `json:"season,omitempty"` Episodes []SingleEpisode `json:"episodes,omitempty"` }
SingleSeason single season & its episodes
type SingleVersion ¶
type SingleVersion struct { Attributes []string `json:"attributes,omitempty"` Language string `json:"language,omitempty"` Region string `json:"region,omitempty"` Title string `json:"title"` }
SingleVersion one Version of a title
type SoundTrack ¶
type SoundTrack struct { Comment string `json:"comment" ` Name string `json:"name" ` RelatedNames []NameBasic `json:"relatedNames"` }
SoundTrack a single SoundTrack result
type T ¶
type T struct { Meta struct { Operation string `json:"operation"` RequestId string `json:"requestId"` ServiceTimeMs float64 `json:"serviceTimeMs"` } `json:"@meta"` Resource struct { Type string `json:"@type"` Base struct { Episode int `json:"episode"` Id string `json:"id"` Image struct { Height int `json:"height"` Id string `json:"id"` Url string `json:"url"` Width int `json:"width"` } `json:"image"` RunningTimeInMinutes int `json:"runningTimeInMinutes"` Season int `json:"season"` NextEpisode string `json:"nextEpisode"` ParentTitle struct { Id string `json:"id"` Image struct { Height int `json:"height"` Id string `json:"id"` Url string `json:"url"` Width int `json:"width"` } `json:"image"` Title string `json:"title"` TitleType string `json:"titleType"` Year int `json:"year"` } `json:"parentTitle"` PreviousEpisode string `json:"previousEpisode"` SeriesEndYear int `json:"seriesEndYear"` SeriesStartYear int `json:"seriesStartYear"` Title string `json:"title"` TitleType string `json:"titleType"` Year int `json:"year"` } `json:"base"` FilmingLocations []struct { Id string `json:"id"` Location string `json:"location"` } `json:"filmingLocations"` MetacriticScore struct { Type string `json:"@type"` ReviewCount int `json:"reviewCount"` UserRatingCount int `json:"userRatingCount"` } `json:"metacriticScore"` Plot struct { Outline struct { Id string `json:"id"` Text string `json:"text"` } `json:"outline"` Summaries []struct { Author string `json:"author"` Id string `json:"id"` Text string `json:"text"` } `json:"summaries"` TotalSummaries int `json:"totalSummaries"` } `json:"plot"` Ratings struct { Episode int `json:"episode"` Id string `json:"id"` Season int `json:"season"` Title string `json:"title"` TitleType string `json:"titleType"` Year int `json:"year"` CanRate bool `json:"canRate"` Rating float64 `json:"rating"` RatingCount int `json:"ratingCount"` RatingsHistograms struct { FemalesAged3044 struct { AggregateRating float64 `json:"aggregateRating"` Demographic string `json:"demographic"` Histogram struct { Field1 int `json:"1"` Field2 int `json:"2"` Field3 int `json:"3"` Field4 int `json:"4"` Field5 int `json:"5"` Field6 int `json:"6"` Field7 int `json:"7"` Field8 int `json:"8"` Field9 int `json:"9"` Field10 int `json:"10"` } `json:"histogram"` TotalRatings int `json:"totalRatings"` } `json:"Females Aged 30-44"` Aged1829 struct { AggregateRating float64 `json:"aggregateRating"` Demographic string `json:"demographic"` Histogram struct { Field1 int `json:"1"` Field2 int `json:"2"` Field3 int `json:"3"` Field4 int `json:"4"` Field5 int `json:"5"` Field6 int `json:"6"` Field7 int `json:"7"` Field8 int `json:"8"` Field9 int `json:"9"` Field10 int `json:"10"` } `json:"histogram"` TotalRatings int `json:"totalRatings"` } `json:"Aged 18-29"` NonUSUsers struct { AggregateRating float64 `json:"aggregateRating"` Demographic string `json:"demographic"` Histogram struct { Field1 int `json:"1"` Field2 int `json:"2"` Field3 int `json:"3"` Field4 int `json:"4"` Field5 int `json:"5"` Field6 int `json:"6"` Field7 int `json:"7"` Field8 int `json:"8"` Field9 int `json:"9"` Field10 int `json:"10"` } `json:"histogram"` TotalRatings int `json:"totalRatings"` } `json:"Non-US users"` MalesAged45 struct { AggregateRating float64 `json:"aggregateRating"` Demographic string `json:"demographic"` Histogram struct { Field1 int `json:"1"` Field2 int `json:"2"` Field3 int `json:"3"` Field4 int `json:"4"` Field5 int `json:"5"` Field6 int `json:"6"` Field7 int `json:"7"` Field8 int `json:"8"` Field9 int `json:"9"` Field10 int `json:"10"` } `json:"histogram"` TotalRatings int `json:"totalRatings"` } `json:"Males Aged 45+"` Males struct { AggregateRating float64 `json:"aggregateRating"` Demographic string `json:"demographic"` Histogram struct { Field1 int `json:"1"` Field2 int `json:"2"` Field3 int `json:"3"` Field4 int `json:"4"` Field5 int `json:"5"` Field6 int `json:"6"` Field7 int `json:"7"` Field8 int `json:"8"` Field9 int `json:"9"` Field10 int `json:"10"` } `json:"histogram"` TotalRatings int `json:"totalRatings"` } `json:"Males"` Females struct { AggregateRating float64 `json:"aggregateRating"` Demographic string `json:"demographic"` Histogram struct { Field1 int `json:"1"` Field2 int `json:"2"` Field3 int `json:"3"` Field4 int `json:"4"` Field5 int `json:"5"` Field6 int `json:"6"` Field7 int `json:"7"` Field8 int `json:"8"` Field9 int `json:"9"` Field10 int `json:"10"` } `json:"histogram"` TotalRatings int `json:"totalRatings"` } `json:"Females"` MalesAged3044 struct { AggregateRating float64 `json:"aggregateRating"` Demographic string `json:"demographic"` Histogram struct { Field1 int `json:"1"` Field2 int `json:"2"` Field3 int `json:"3"` Field4 int `json:"4"` Field5 int `json:"5"` Field6 int `json:"6"` Field7 int `json:"7"` Field8 int `json:"8"` Field9 int `json:"9"` Field10 int `json:"10"` } `json:"histogram"` TotalRatings int `json:"totalRatings"` } `json:"Males Aged 30-44"` Top1000Voters struct { AggregateRating float64 `json:"aggregateRating"` Demographic string `json:"demographic"` Histogram struct { Field1 int `json:"1"` Field2 int `json:"2"` Field3 int `json:"3"` Field4 int `json:"4"` Field5 int `json:"5"` Field6 int `json:"6"` Field7 int `json:"7"` Field8 int `json:"8"` Field9 int `json:"9"` Field10 int `json:"10"` } `json:"histogram"` TotalRatings int `json:"totalRatings"` } `json:"Top 1000 voters"` MalesAged1829 struct { AggregateRating float64 `json:"aggregateRating"` Demographic string `json:"demographic"` Histogram struct { Field1 int `json:"1"` Field2 int `json:"2"` Field3 int `json:"3"` Field4 int `json:"4"` Field5 int `json:"5"` Field6 int `json:"6"` Field7 int `json:"7"` Field8 int `json:"8"` Field9 int `json:"9"` Field10 int `json:"10"` } `json:"histogram"` TotalRatings int `json:"totalRatings"` } `json:"Males Aged 18-29"` FemalesAged45 struct { AggregateRating float64 `json:"aggregateRating"` Demographic string `json:"demographic"` Histogram struct { Field1 int `json:"1"` Field2 int `json:"2"` Field3 int `json:"3"` Field4 int `json:"4"` Field5 int `json:"5"` Field6 int `json:"6"` Field7 int `json:"7"` Field8 int `json:"8"` Field9 int `json:"9"` Field10 int `json:"10"` } `json:"histogram"` TotalRatings int `json:"totalRatings"` } `json:"Females Aged 45+"` IMDbUsers struct { AggregateRating float64 `json:"aggregateRating"` Demographic string `json:"demographic"` Histogram struct { Field1 int `json:"1"` Field2 int `json:"2"` Field3 int `json:"3"` Field4 int `json:"4"` Field5 int `json:"5"` Field6 int `json:"6"` Field7 int `json:"7"` Field8 int `json:"8"` Field9 int `json:"9"` Field10 int `json:"10"` } `json:"histogram"` TotalRatings int `json:"totalRatings"` } `json:"IMDb Users"` IMDbStaff struct { AggregateRating float64 `json:"aggregateRating"` Demographic string `json:"demographic"` Histogram struct { Field1 int `json:"1"` Field2 int `json:"2"` Field3 int `json:"3"` Field4 int `json:"4"` Field5 int `json:"5"` Field6 int `json:"6"` Field7 int `json:"7"` Field8 int `json:"8"` Field9 int `json:"9"` Field10 int `json:"10"` } `json:"histogram"` TotalRatings int `json:"totalRatings"` } `json:"IMDb Staff"` FemalesAgedUnder18 struct { AggregateRating float64 `json:"aggregateRating"` Demographic string `json:"demographic"` Histogram struct { Field1 int `json:"1"` Field2 int `json:"2"` Field3 int `json:"3"` Field4 int `json:"4"` Field5 int `json:"5"` Field6 int `json:"6"` Field7 int `json:"7"` Field8 int `json:"8"` Field9 int `json:"9"` Field10 int `json:"10"` } `json:"histogram"` TotalRatings int `json:"totalRatings"` } `json:"Females Aged under 18"` FemalesAged1829 struct { AggregateRating float64 `json:"aggregateRating"` Demographic string `json:"demographic"` Histogram struct { Field1 int `json:"1"` Field2 int `json:"2"` Field3 int `json:"3"` Field4 int `json:"4"` Field5 int `json:"5"` Field6 int `json:"6"` Field7 int `json:"7"` Field8 int `json:"8"` Field9 int `json:"9"` Field10 int `json:"10"` } `json:"histogram"` TotalRatings int `json:"totalRatings"` } `json:"Females Aged 18-29"` Aged45 struct { AggregateRating float64 `json:"aggregateRating"` Demographic string `json:"demographic"` Histogram struct { Field1 int `json:"1"` Field2 int `json:"2"` Field3 int `json:"3"` Field4 int `json:"4"` Field5 int `json:"5"` Field6 int `json:"6"` Field7 int `json:"7"` Field8 int `json:"8"` Field9 int `json:"9"` Field10 int `json:"10"` } `json:"histogram"` TotalRatings int `json:"totalRatings"` } `json:"Aged 45+"` USUsers struct { AggregateRating float64 `json:"aggregateRating"` Demographic string `json:"demographic"` Histogram struct { Field1 int `json:"1"` Field2 int `json:"2"` Field3 int `json:"3"` Field4 int `json:"4"` Field5 int `json:"5"` Field6 int `json:"6"` Field7 int `json:"7"` Field8 int `json:"8"` Field9 int `json:"9"` Field10 int `json:"10"` } `json:"histogram"` TotalRatings int `json:"totalRatings"` } `json:"US users"` MalesAgedUnder18 struct { AggregateRating float64 `json:"aggregateRating"` Demographic string `json:"demographic"` Histogram struct { Field1 int `json:"1"` Field2 int `json:"2"` Field3 int `json:"3"` Field4 int `json:"4"` Field5 int `json:"5"` Field6 int `json:"6"` Field7 int `json:"7"` Field8 int `json:"8"` Field9 int `json:"9"` Field10 int `json:"10"` } `json:"histogram"` TotalRatings int `json:"totalRatings"` } `json:"Males Aged under 18"` AgedUnder18 struct { AggregateRating float64 `json:"aggregateRating"` Demographic string `json:"demographic"` Histogram struct { Field1 int `json:"1"` Field2 int `json:"2"` Field3 int `json:"3"` Field4 int `json:"4"` Field5 int `json:"5"` Field6 int `json:"6"` Field7 int `json:"7"` Field8 int `json:"8"` Field9 int `json:"9"` Field10 int `json:"10"` } `json:"histogram"` TotalRatings int `json:"totalRatings"` } `json:"Aged under 18"` Aged3044 struct { AggregateRating float64 `json:"aggregateRating"` Demographic string `json:"demographic"` Histogram struct { Field1 int `json:"1"` Field2 int `json:"2"` Field3 int `json:"3"` Field4 int `json:"4"` Field5 int `json:"5"` Field6 int `json:"6"` Field7 int `json:"7"` Field8 int `json:"8"` Field9 int `json:"9"` Field10 int `json:"10"` } `json:"histogram"` TotalRatings int `json:"totalRatings"` } `json:"Aged 30-44"` } `json:"ratingsHistograms"` } `json:"ratings"` } `json:"resource"` }
type Title ¶
type Title struct { TitleBasic `json:"titleBasic"` PlotSummaries []PlotSummary `json:"plotSummaries,omitempty"` Rating Rating `json:"rating" json:"rating"` // contains filtered or unexported fields }
Title type - This type holds the most basic information from the API. Additional calls to its various methods will return additional data
func (*Title) GetTitleCredits ¶
func (t *Title) GetTitleCredits() (crds map[string][]SingleCredit, err error)
get the credits for a title (all the possible positions and people that were involved in it).
func (*Title) GetTitleEpisodes ¶
func (t *Title) GetTitleEpisodes() ([]SingleSeason, error)
GetTitleEpisodes - get all episodes for a series title
func (*Title) GetTitleGenres ¶
get the Genres of a title
func (*Title) GetTitleImages ¶
func (t *Title) GetTitleImages() (imgs []ImageDetail, err error)
get Images for a title
func (*Title) GetTitleVersions ¶
func (t *Title) GetTitleVersions() (vr VersionInfo, err error)
get Versions (i.e. different countires, languages etc) for a title
type Title1 ¶
type Title1 struct { Type string Certification string Year int Genres *[]string Writers *[]People Creators *[]People //Credits *[]People /removed since hard to get data from json need reflection Directors *[]People Stars *[]People Image Image Episodes int Rating_count int Releases *TitleReleases Season int Episode int Rating float64 Plot_outline string Release_date time.Time Runtime int // contains filtered or unexported fields }
Response data models - this is the json of the various repsonses I picked up.
Title represnet a movie or tvseries title. The data is extracted as best as possible from the json returned by the api
type TitleBasic ¶
type TitleBasic struct { TitleMinimal SeriesEndYear int `json:"seriesEndYear"` SeriesStartYear int `json:"seriesStartYear"` Episode int `json:"episode"` Season int `json:"season"` NextEpisode string `json:"nextEpisode"` PreviousEpisode string `json:"previousEpisode"` NumberOfEpisodes int `json:"numberOfEpisodes"` PlotOutline string ParentTitle TitleMinimal // holds the id of the parent series }
TitleBasic Basic title information
type TitleEpisodes ¶
type TitleMinimal ¶
type TitleMinimal struct { ID string `json:"id"` Image ImageBasic `json:"image"` Title string `json:"title"` TitleType string `json:"titleType"` Year int `json:"year"` RunTime int `json:"runningTimeInMinutes"` }
TitleMinimal minimal info title (this is returned in similarities etc)
type TitleRelease ¶
type TitleReleases ¶
type TitleReleases []TitleRelease
type VersionInfo ¶
type VersionInfo struct { Releases []SingleVersion `json:"releases,omitempty"` OriginalTitle string `json:"originalTitle,omitempty"` DefaultTitle string `json:"defaultTitle,omitempty"` Origins []string `json:"origins,omitempty"` SpokenLanguages []string `json:"spokenLanguages,omitempty"` }
VersionInfo Versions information