Merge pull request #189 from lem6ns/external_ids

fix(meta): fallback to no "_latest"
This commit is contained in:
mrjvs 2023-03-10 21:04:27 +01:00 committed by GitHub
commit 30d8e11992
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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