[scraper] check if id is number when getting metadata

This commit is contained in:
TheBeastLT
2020-05-20 10:36:06 +02:00
parent 6c502b714a
commit c5271c8490

View File

@@ -16,7 +16,7 @@ function getMetadata(id, type = Type.SERIES) {
return Promise.reject("no valid id provided");
}
const key = id.match(/^\d+$/) ? `kitsu:${id}` : id;
const key = Number.isInteger(id) || id.match(/^\d+$/) ? `kitsu:${id}` : id;
const metaType = type === Type.MOVIE ? Type.MOVIE : Type.SERIES;
return cacheWrapMetadata(key,
() => _requestMetadata(`${KITSU_URL}/meta/${metaType}/${key}.json`)