-
Notifications
You must be signed in to change notification settings - Fork 2
TitleSearchAdvanced
duck7000 edited this page Feb 16, 2024
·
31 revisions
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 results are random based on config options (not very useful..)
At least one parameter of those types: ($genres, $types, $creditId, $startDate, $endDate) has to be provided!
$imdb = new \Imdb\TitleSearchAdvanced();
$results = $imdb->advancedSearch($genres, $types, $creditId, $startDate, $endDate);
There are 3 options in config:
titleSearchAdvancedAmount: 250 (limits the search results, default: 250
SortBy: "POPULARITY" (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
- 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 nm0001228 so use 'nm0001228' as creditId
- 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 will use (0001-01-01 - present server date)
@return Title[] array of Titles
array[]
['imdbid'] string imdbid from the found title<br> ['originalTitle'] string originalTitle from the found title<br> ['title'] string title from the found title<br> ['year'] string year or year span from the found title<br> ['movietype'] string titleType from the found title<br> ['rank'] int rank number from the found title<br> ['rating'] float/int rating from the found title<br> ['plot'] string plot from the found title<br> ['imgUrl'] string image url from the found title (thumbnail 140x207)<br>