-
Notifications
You must be signed in to change notification settings - Fork 2
TitleSearchAdvanced
You can use this class to make advanced searches on imdb GraphQL API
The default parameters are all empty as you need to provide search input.
Calling advancedSearch without any parameters returns empty array, no point to search, so at least one parameter has to be provided!
$imdb = new \Imdb\TitleSearchAdvanced();
$results = $imdb->advancedSearch();
There are 5 options in config:
titleSearchAdvancedAmount: 250 (limits the search results, default: 250
SortBy: default: "POPULARITY"
SortBy values:
BOX_OFFICE_GROSS_DOMESTIC Gross revenue pulled in via box-office in Domestic market for entire lifetime of title. Domestic refers to North America (U.S., Canada, and Puerto Rico) ASC: Lower numbers means the title has pulled in less box-office revenue, so poorer performing titles will be first. METACRITIC_SCORE Overall Metascore based on critic reviews. Titles without a metascore are placed at the end when using ASC sort order. ASC: Lower Metacritic score means the title is rated more poorly, so titles with worse scores will be first. MY_RATING Star Rating given by the requesting user. ASC: Lower star rating means the title the user rated the title more poorly, so most disliked titles will be first. MY_RATING_DATE Date when customer rated a title. ASC: Earlier (older) ratings will be first. POPULARITY TitleMeterType.TITLE_METER (aka Pro MOVIEMeter). Score given to non-episodic title types. ASC: Lower popularity score means that the title is more popular, so the most popular titles will be first. RANKING Sort results based on specified ranking algorithm. For the advancedTitleSearch query, exactly one ranked title list constraint must be specified for using this sort option. ASC: Higher ranks will be first. RELEASE_DATE Earliest wide release date of a title. Titles without a release date are placed at the end when using ASC sort order. ASC: Earlier (older) released title will be first. RUNTIME The length of the title in terms of runtime. ASC: Lower runtime means the title is shorter, so shortest titles will be first. TITLE_REGIONAL Alphabetical sorting based on regional title text as determined by user language preferences. Language preference is determined by x-imdb-user-country and x-imdb-user-language headers. Only supports the languages/regions we support for localized search. Defaults to original title otherwise. ASC: Lower numbers and letters near the top of the alphabet will be returned first. USER_RATING Weighted IMDb Star Rating as determined by users Note: IMDb maintains a threshold to a minimum number of ratings before it is considered. ASC: Lower star rating means the title is rated more poorly, so titles with worse ratings will be first. USER_RATING_COUNT Count of ratings given by users Note: IMDb maintains a threshold to a minimum number of ratings before it is considered. ASC: Lower count of ratings means the title has been rated a fewer number of times, so titles with least ratings will be first. YEAR The recognized year of the title. Typically, the release year, but guidelines are here: https://help.imdb.com/article/contribution/titles/title-formatting/G56U5ERK7YY47CQB ASC: Earlier (older) titles will be first.<br>
SortOrder: "ASC" (default: "ASC")
ASC Ascending order e.g. 1,2,3 DESC Descending order e.g. 3,2,1
titleSearchAdvancedThumbnailWidth: Default: 140, can be set to just about anything but keep ratio in mind
titleSearchAdvancedThumbnailHeight: Default: 207, can be set to just about anything but keep ratio in mind
-
searchTerm: search on specific title text like "the matrix" or "pirates"
This searches only on titleText, not a general text search.
Matches titles on original and regional name and affected by localization. -
genres: search on specific genres (can be more then one, separate by ,) (Horror,Action etc) It works by using genreId's:
Action, Adult, Adventure, Animation, Biography, Comedy, Crime, Documentary, Drama, Family, Fantasy, Film-Noir, Game-Show, History, Horror, Music, Musical, Mystery, News, Reality-TV, Romance, Sci-Fi, Short, Sport, Talk-Show, Thriller, War, Western
- types: search on specific titleTypes (can be more then one, separate by ,) (movie,tvSeries etc) It works by using titleTypeId's:
movie, tvSeries, short, tvEpisode, tvMiniSeries, tvMovie, tvSpecial, tvShort, videoGame, video, musicVideo, podcastSeries, podcastEpisode
- creditId: search on specific person (actor or producer etc) single person id only, it works by using creditId's:
Example Peter Fonda has creditId 0001228 so use '0001228' as creditId (without "nm")
- ReleaseDate: Search on specific start and/or end date. Dates must be in iso form like this: '1950-01-01' (year-month-day)
$startDate: if provided search start at this date until present date (1950 - present date) $endDate: if provided search start at this date and earlier (1955 - older) If both $startDate and $endDate are provided search will be limited within this date period If no $startDate or $endDate is provided search within all dates is used
- countryId: iso 3166 country code like "US" or "US,DE" (separate by comma)
Codes can be found here: https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
- languageId: iso 639 Language code like "en" or "en,de" (separate by comma)
Codes can be found here: https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes
-
keywords: like "sex" or "sex,drugs" (separate by comma)
-
companyId: like "0185428" (single companyid is supported, without "co")
@return Title[] array of Titles
array[]
['imdbid'] string imdbid from the found title ['originalTitle'] string originalTitle from the found title ['title'] string title from the found title ['year'] string year or year span from the found title ['movietype'] string titleType from the found title [runtime] => string In seconds! [rating] => float [voteCount] => int [metacritic] => int [plot] => string [imgUrl] => string ImageUrl for thumbnail