sanitize retrieved metas
This commit is contained in:
@@ -21,7 +21,8 @@ function _requestMetadata(ids, type) {
|
|||||||
const url = _getUrl(ids, type);
|
const url = _getUrl(ids, type);
|
||||||
return axios.get(url, { timeout: TIMEOUT })
|
return axios.get(url, { timeout: TIMEOUT })
|
||||||
.then(response => response?.data?.metas || response?.data?.metasDetailed || [])
|
.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) {
|
function _getUrl(ids, type) {
|
||||||
@@ -32,4 +33,11 @@ function _getUrl(ids, type) {
|
|||||||
return `${CINEMETA_URL}/catalog/${type}/last-videos/lastVideosIds=${joinedIds}.json`
|
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 };
|
module.exports = { getMetas };
|
||||||
|
|||||||
Reference in New Issue
Block a user