mirror of
https://github.com/TheBeastLT/torrentio-scraper.git
synced 2026-03-11 17:15:37 +00:00
sanitize retrieved metas
This commit is contained in:
parent
0ef906dacc
commit
6c48f9e263
1 changed files with 9 additions and 1 deletions
|
|
@ -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 };
|
||||
|
|
|
|||
Loading…
Reference in a new issue