Update utils.js

This commit is contained in:
freearhey 2021-04-17 13:44:42 +03:00
parent b619ce2254
commit 8940f5fc33
1 changed files with 7 additions and 2 deletions

View File

@ -171,8 +171,13 @@ utils.parsePrograms = function ({ response, item, config }) {
buffer: response.data
})
return config
.parser(options)
const programs = config.parser(options)
if (!Array.isArray(programs)) {
throw new Error('Parser should return an array')
}
return programs
.filter(i => i)
.map(p => {
p.channel = item.channel.xmltv_id