I think it's a good idea to add a few extra critical details to the movie list response for each movie, without having to seek the other endpoints for them. I've included a few suggestions and would love to hear others thoughts. Please include anything you'd like as well.
*Logo Path
*
-I think it's worthwhile including the best logo.
-Currently, you have to request the images
endpoint and receive all the backdrops, posters, and logos for the movie.
-Since the list returns the backdrop_path
, and the poster_path
, I think it's fair to also have the logo_path
here as well.
*Genres
*
-Since the movie list already returns a genre_ids
field, I think it's fair to just include the genre name
in this field as well - as it appears in the details
response. I don't understand the purpose of this very minor discrepancy between the two.
-Currently, the movie lists return a genre_ids
field as an array of numbers.
-The detailed endpoint returns a genres
field as an array of { id : number, name : string}
objects.
-I had to setup the following to avoid having to fetch the detailed endpoint for each movie in the list just to get the genre's.
-I constructed my genreMap but fetching the https://api.themoviedb.org/3/genre/movie/list
and https://api.themoviedb.org/3/genre/tv/list
and I think it's kind of dumb to have to manage this yourself (if the genre's get updated, etc).
const genreMap: Record<number, string> = {
// Movies
28: "Action",
12: "Adventure",
16: "Animation",
35: "Comedy",
80: "Crime",
99: "Documentary",
18: "Drama",
10751: "Family",
14: "Fantasy",
36: "History",
27: "Horror",
10402: "Music",
9648: "Mystery",
10749: "Romance",
878: "Science Fiction",
10770: "TV Movie",
53: "Thriller",
10752: "War",
37: "Western",
// TV Shows
10759: "Action & Adventure",
10762: "Kids",
10763: "News",
10764: "Reality",
10765: "Sci-Fi & Fantasy",
10766: "Soap",
10767: "Talk",
10768: "War & Politics",
};
export const getGenreNames = (genreIds: number[]): string[] => {
return genreIds.map((id) => genreMap[id]).filter(Boolean);
};
*Age Rating
*
-Just found for movies, you get this from Release Dates https://api.themoviedb.org/3/movie/{movie_id}/release_dates
endpoint.
details
endpoint for a specific movie.
-G, PG, PG-13, RThis is all I could think of for now as my main request is for the logo_path
. Would love to hear other's thoughts. Thanks folks.
P.S. - Currently, a movie in the returned Movie Lists has the following type:
{
adult: boolean;
backdrop_path: string;
genre_ids: number[];
id: number;
original_language: string;
original_title: string;
overview: string;
popularity: number;
poster_path: string;
release_date: string;
title: string;
video: boolean;
vote_average: number;
vote_count: number;
}
¿No encuentras una película o serie? Inicia sesión para crearla:
¿Quieres puntuar o añadir este elemento a una lista?
¿No eres miembro?