API Reference¶
Functions¶
- class imdbio.services.TitleType(*values)[source]¶
Bases:
EnumDefines the valid ‘ttype’ filters for title searches on IMDb. The values correspond to the URL parameter used in search queries.
- Movies = 'ft'¶
- Series = 'tv'¶
- Episodes = 'ep'¶
- Shorts = 'sh'¶
- TvMovie = 'tvm'¶
- Video = 'v'¶
- imdbio.services.get_movie(imdb_id, locale=None)[source]¶
Fetch movie details from IMDb using the provided IMDb ID as string, preserve the ‘tt’ prefix or not, it will be stripped in the function.
- Return type:
- imdbio.services.search_title(search_term, year=None, exact_match=False, locale=None, title_type=None)[source]¶
- Return type:
- imdbio.services.get_name(person_id, locale=None)[source]¶
Fetch person details from IMDb using the provided IMDb ID. Preserve the ‘nm’ prefix or not, it will be stripped in the function.
- Return type:
- imdbio.services.get_season_episodes(imdb_id, season=1, locale=None)[source]¶
Fetch episodes for a movie or series using the provided IMDb ID.
- Return type:
- imdbio.services.get_episodes(imdb_id, season=1, locale=None)[source]¶
wrap until deprecation : use get_season_episodes instead for seasons or get_all_episodes for all episodes
- Return type:
- imdbio.services.get_all_interests(imdb_id, locale=None)[source]¶
Fetch all ‘interests’ for a title using the provided IMDb ID.
In the context of IMDb data, ‘interests’ are thematic tags, topics, or metadata associated with a title, such as genres, themes, or other descriptors that go beyond the standard genre classification. These interests are extracted from the extended title information returned by IMDb’s GraphQL API.
Note: This function makes an additional request to IMDb’s GraphQL endpoint, which may be slower and more resource-intensive than standard API calls. Use this function only if you require interests beyond what is available in movie.genres, as it can impact performance.
Models¶
- class imdbio.models.Person(**data)[source]¶
Bases:
BaseModelperson model for directors, cast and search results. This model is used to represent a person in the IMDb database. It can be used for directors, cast members and search results. It contains the basic information about a person such as name, id, imdb_id, imdbId, url and job.
- class imdbio.models.TitleMediaGallery(**data)[source]¶
Bases:
BaseModel- items: List[TitleMediaItem]¶
- class imdbio.models.SeriesMixin[source]¶
Bases:
object
- class imdbio.models.CastMember(**data)[source]¶
Bases:
PersonCast member model for cast members in a movie. This model extends the Person model to include additional information specific to cast members. It includes the characters they played in the movie and their picture URL.
- class imdbio.models.CompanyInfo(**data)[source]¶
Bases:
BaseModelCompanyInfo model for production companies and other companies involved in a movie. This model contains basic information about a company such as name, id, imdb_id, imdbId, url, attributes and countries.
- class imdbio.models.AwardInfo(**data)[source]¶
Bases:
BaseModelModel to group award-related counts for a title.
- Fields:
wins (Optional[int]): Number of wins. nominations (Optional[int]): Number of nominations. prestigious_award (Optional[dict]): Details of a prestigious award, if any.
- class imdbio.models.MovieDetail(**data)[source]¶
Bases:
SeriesMixin,BaseModelMovieDetail model for detailed information about a movie. This model contains all the information about a movie such as title, id, imdb_id, imdbId, url, cover_url, plot, release_date, languages, certificates, directors, stars, year, duration, country_codes, rating, metacritic_rating, votes, trailers, genres, interests, worldwide_gross, production_budget, storyline_keywords, filming_locations, sound_mixes, processes, printed_formats, negative_formats, laboratories, colorations, cameras, aspect_ratios, summaries, synopses, production and categories. It also includes a field_validator to ensure that certain fields are lists and not None.
- company_credits: Dict[str, List[CompanyInfo]]¶
- class imdbio.models.TvSeriesDetail(**data)[source]¶
Bases:
MovieDetail- info_series: InfoSeries | None¶
- class imdbio.models.TvEpisodeDetail(**data)[source]¶
Bases:
MovieDetail- info_episode: InfoEpisode | None¶
- class imdbio.models.MovieBriefInfo(**data)[source]¶
Bases:
SeriesMixin,BaseModelMovieBriefInfo model for search results and cast members. This model is used to represent a movie in search results and cast members. It contains basic information about a movie such as title, id, imdb_id, imdbId, url, cover_url, year, rating and kind. It can be used to represent a movie in search results or as part of a cast member’s credits. It includes class methods to create an instance from search results and cast data.
- class imdbio.models.SearchResult(**data)[source]¶
Bases:
BaseModelSearchResult model for search results. This model contains the results of a search query, including a list of titles and names. It is used to represent the results of a search query for movies and people. It includes a list of MovieBriefInfo objects for titles and a list of Person objects for names.
- titles: List[MovieBriefInfo]¶
- class imdbio.models.PersonDetail(**data)[source]¶
Bases:
BaseModelPersonDetail model for detailed information about a person. This model contains all the information about a person such as id, imdb_id, imdbId, name, url, knownfor, image_url, bio, height, primary_profession, birth_date, birth_place, death_date, death_place, jobs, credits and unreleased_credits.
- credits: Dict[str, List[MovieBriefInfo]]¶
- unreleased_credits: Dict[str, List[MovieBriefInfo]]¶
- class imdbio.models.SeasonEpisode(**data)[source]¶
Bases:
BaseModel
- class imdbio.models.BulkedEpisode(**data)[source]¶
Bases:
BaseModel
- class imdbio.models.SeasonEpisodesList(**data)[source]¶
Bases:
BaseModelEpisodesList model for a list of episodes. This model contains a list of EpisodeInfo objects representing the episodes of a series. It can be used to represent the episodes of a series in a specific season.
- episodes: List[SeasonEpisode]¶
- class imdbio.models.AkaInfo(**data)[source]¶
Bases:
BaseModel
- class imdbio.models.ParentalGuideContentDescription(**data)[source]¶
Bases:
BaseModel
- class imdbio.models.ParentalGuideCategory(**data)[source]¶
Bases:
BaseModel- content_descriptions: List[ParentalGuideContentDescription]¶
- has_category_texts()[source]¶
Return True if there are any guide items in this category.
- Return type:
Exceptions¶
imdbio exception hierarchy¶
ImdbioError ├── HTTPError — any non-200 HTTP response (status_code, url, response_text) │ └── WAFError — HTTP 202 from AWS WAF enforcement ├── GraphQLError — non-200 or {“errors”: …} from the GraphQL endpoint └── ParseError — __NEXT_DATA__ script not found in HTML response
- exception imdbio.exceptions.ImdbioError[source]¶
Bases:
ExceptionBase class for all imdbio exceptions.
- exception imdbio.exceptions.HTTPError(message, status_code, url, response_text='')[source]¶
Bases:
ImdbioErrorRaised when the IMDb HTML endpoint returns a non-200 status code.
- exception imdbio.exceptions.WAFError(message, status_code, url, response_text='')[source]¶
Bases:
HTTPErrorRaised when AWS WAF returns HTTP 202, blocking the request.
This is a subclass of
HTTPErrorso callers that catchHTTPErrorwill also catchWAFError. Callers that want to handle WAF enforcement specifically (e.g. to rotate proxies or back off) can catchWAFErrordirectly.
- exception imdbio.exceptions.GraphQLError(message, url, query_term, status_code=None, errors=None, response_text='')[source]¶
Bases:
ImdbioErrorRaised when the IMDb GraphQL API returns a non-200 status or an
{"errors": […]}payload.- status_code¶
HTTP status code when the failure is transport-level;
Nonewhen the response was 200 but contained GraphQLerrors.- Type:
Optional[int]
- exception imdbio.exceptions.ParseError(message, url='')[source]¶
Bases:
ImdbioErrorRaised when the expected
__NEXT_DATA__JSON script tag is absent from the IMDb HTML response.
Proxy¶
- imdbio.proxy.set_proxy(proxy_url)[source]¶
Set (or clear) the global proxy used for all imdbio requests.
- Parameters:
proxy_url – A proxy URL such as
"http://user:pass@host:port". Supported schemes are http, https, socks4, socks5 and socks5h. PassNoneto disable proxying.- Raises:
ValueError – If
proxy_urlis notNoneand is not a valid proxy URL.- Return type: