mirror of
https://github.com/movie-web/movie-web.git
synced 2024-11-11 00:55:05 +01:00
Merge pull request #189 from lem6ns/external_ids
fix(meta): fallback to no "_latest"
This commit is contained in:
commit
30d8e11992
@ -54,12 +54,17 @@ export async function getMetaFromId(
|
|||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|
||||||
const imdbId = data.external_ids.find(
|
let imdbId = data.external_ids.find(
|
||||||
(v) => v.provider === "imdb_latest"
|
(v) => v.provider === "imdb_latest"
|
||||||
)?.external_id;
|
)?.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"
|
(v) => v.provider === "tmdb_latest"
|
||||||
)?.external_id;
|
)?.external_id;
|
||||||
|
if (!tmdbId)
|
||||||
|
tmdbId = data.external_ids.find((v) => v.provider === "tmdb")?.external_id;
|
||||||
|
|
||||||
if (!imdbId || !tmdbId) throw new Error("not enough info");
|
if (!imdbId || !tmdbId) throw new Error("not enough info");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user