### Install tvdb-v4-python Package Source: https://github.com/thetvdb/tvdb-v4-python/blob/main/README.md Installs the official tvdb_v4_official Python package using pip. ```bash python3 -m pip install tvdb_v4_official ``` -------------------------------- ### Fetch Season Episode List Source: https://github.com/thetvdb/tvdb-v4-python/blob/main/README.md Fetches extended series data to get season and episode information. It then retrieves extended details for a specific season and prints its episodes. ```python # fetching a season's episode list series = tvdb.get_series_extended(121361) for season in sorted(series["seasons"], key=lambda x: (x["type"]["name"], x["number"])): if season["type"]["name"] == "Aired Order" and season["number"] == 1: season = tvdb.get_season_extended(season["id"]) break else: season = None if season is not None: print(season["episodes"]) ``` -------------------------------- ### Initialize TVDB Client Source: https://github.com/thetvdb/tvdb-v4-python/blob/main/README.md Initializes the TVDB client with an API key, optionally including a PIN for certain operations. This is the first step to interact with the TVDB API. ```python import tvdb_v4_official tvdb = tvdb_v4_official.TVDB("APIKEY") # OR: # tvdb = tvdb_v4_official.TVDB("APIKEY", pin="YOUR PIN HERE") ``` -------------------------------- ### Fetch Series Episodes by Page Source: https://github.com/thetvdb/tvdb-v4-python/blob/main/README.md Retrieves a page of episodes for a given series, optionally filtering by season type. It prints the series information and each episode. ```python # fetch a page of episodes from a series by season_type (type is "default" if unspecified) info = tvdb.get_series_episodes(121361, page=0) print(info["series"]) for ep in info["episodes"]: print(ep) ``` -------------------------------- ### Fetch Movie Data Source: https://github.com/thetvdb/tvdb-v4-python/blob/main/README.md Retrieves basic information for a specific movie using its ID. ```python # fetching a movie movie = tvdb.get_movie(31) # avengers ``` -------------------------------- ### Fetch Series Information Source: https://github.com/thetvdb/tvdb-v4-python/blob/main/README.md Fetches multiple pages of series information from the TVDB API. It iterates through pages, appending series data to a list. ```python # fetching several pages of series info series_list = [ ] for j in range(5): # Pages are numbered from 0 series_list += tvdb.get_all_series(j) ``` -------------------------------- ### Fetch Single Series Data Source: https://github.com/thetvdb/tvdb-v4-python/blob/main/README.md Retrieves detailed information for a specific series using its ID. ```python # fetching a series series = tvdb.get_series(121361) ``` -------------------------------- ### Fetch Person Record Source: https://github.com/thetvdb/tvdb-v4-python/blob/main/README.md Retrieves extended data for a person using their ID, typically obtained from movie or series character data. ```python # fetching a person record person = tvdb.get_person_extended(characters[0]["peopleId"]) print(person) ``` -------------------------------- ### Access Movie Characters Source: https://github.com/thetvdb/tvdb-v4-python/blob/main/README.md Fetches extended movie data to access the characters associated with a movie. It then iterates and prints each character. ```python # access a movie's characters movie = tvdb.get_movie_extended(31) for c in movie["characters"]: print(c) ``` -------------------------------- ### Conditional Series Fetch with If-Modified-Since Source: https://github.com/thetvdb/tvdb-v4-python/blob/main/README.md Fetches series extended data, but only if the data has been modified since the specified date. This uses the If-Modified-Since header for efficient caching. ```python # using since If-Modified-Since parameter series = tvdb.get_series_extended(393199, if_modified_since="Wed, 30 Jun 2022 07:28:00 GMT") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.