fix(meta): fallback to no "_latest"

This commit is contained in:
cloud 2023-03-09 19:22:41 -07:00
parent 935cb2427b
commit ca6383900a

View File

@ -56,9 +56,13 @@ export async function getMetaFromId(
const imdbId = data.external_ids.find( const imdbId = data.external_ids.find(
(v) => v.provider === "imdb_latest" (v) => v.provider === "imdb_latest"
)?.external_id ?? data.external_ids.find(
(v) => v.provider === "imdb"
)?.external_id; )?.external_id;
const tmdbId = data.external_ids.find( const tmdbId = data.external_ids.find(
(v) => v.provider === "tmdb_latest" (v) => v.provider === "tmdb_latest"
)?.external_id ?? data.external_ids.find(
(v) => v.provider === "tmdb"
)?.external_id; )?.external_id;
if (!imdbId || !tmdbId) throw new Error("not enough info"); if (!imdbId || !tmdbId) throw new Error("not enough info");