sanitize retrieved metas

This commit is contained in:
TheBeastLT
2022-04-20 21:07:34 +02:00
parent 0ef906dacc
commit 6c48f9e263

View File

@@ -21,7 +21,8 @@ function _requestMetadata(ids, type) {
const url = _getUrl(ids, type);
return axios.get(url, { timeout: TIMEOUT })
.then(response => response?.data?.metas || response?.data?.metasDetailed || [])
.then(metas => metas.filter(meta => meta));
.then(metas => metas.filter(meta => meta))
.then(metas => metas.map(meta => _sanitizeMeta(meta)));
}
function _getUrl(ids, type) {
@@ -32,4 +33,11 @@ function _getUrl(ids, type) {
return `${CINEMETA_URL}/catalog/${type}/last-videos/lastVideosIds=${joinedIds}.json`
}
function _sanitizeMeta(meta) {
delete meta.videos;
delete meta.credits_cast;
delete meta.credits_crew;
return meta;
}
module.exports = { getMetas };