IMDB#
Usage#
To access IMDb data points, first ensure you have loaded the IMDb source through:
await phylm.load_source("imdb")
Alternatively you can instantiate the IMDb source class directly through:
from phylm.sources import Imdb
imdb = Imdb(raw_title="The Matrix", raw_year=1999) # raw_year is optional
await imdb.load_source()
Movie ID#
If you know the IMDb movie ID you can instantiate the Phylm class with an imdb_id
property:
from phylm.sources import Imdb
imdb = Imdb(raw_title="The Matrix", imdb_id="0133093")
Then, when running load_source for imdb, phylm will first perform a search based
on the ID. If the ID is valid the result will be selected, if not then it will fall back
to a title search.
Alternatively, you can pass it to load_source with "imdb" as the first argument:
await phylm.load_source("imdb", imdb_id="0133093")
Or instantiate the IMDb source class with the ID:
from phylm.sources import Imdb
imdb = Imdb(movie_id="0133093")
!!! warning “”
If instantiating the class directly you must supply at least one of movie_id
or raw_title, otherwise a ValueError will be raised.
Reference#
- class phylm.sources.imdb.Imdb(raw_title=None, movie_id=None, raw_year=None)#
Class to abstract an IMDb movie object.
- Parameters:
raw_title (str | None) –
movie_id (str | None) –
raw_year (int | None) –
- cast(limit=5)#
Return the cast.
- Parameters:
limit (int) – an optional number of cast members to return
- Returns:
a list of the movie’s cast members
- Return type:
List[str]
- directors(limit=3)#
Return the director(s).
- Parameters:
limit (int) – an optional number of director to return
- Returns:
a list of the movie’s directors
- Return type:
List[str]
- genres(limit=3)#
Return the genres.
- Parameters:
limit (int) – an optional number of genres to return
- Returns:
a list of the movie’s genres
- Return type:
List[str]
- property id: str | None#
Return the IMDb id.
- Returns:
the id of the movie
- async load_source()#
Asynchronously load the data for from the source.
- Return type:
None
- property plot: str | None#
Return the plot.
- Returns:
the plot of the movie
- property rating: float | None#
Return the IMDb rating.
- Returns:
the rating of the movie
- property runtime: str | None#
Return the runtime.
- Returns:
the runtime of the movie
- property title: str | None#
Return the IMDb title.
- Returns:
the title of the movie
- property year: int | None#
Return the movie’s year.
- Returns:
the year the movie was made