Update index.js

This commit is contained in:
Aleksandr Statciuk 2021-10-06 16:38:13 +03:00
parent e11bc75391
commit 2a28c59fb9
1 changed files with 7 additions and 6 deletions

View File

@ -14,7 +14,6 @@ const Result = {
module.exports = {
grab: async function (channel, config, cb) {
cb(Result)
const utcDate = utils.getUTCDate()
const dates = Array.from({ length: config.days }, (_, i) => utcDate.add(i, 'd'))
const queue = []
@ -32,15 +31,17 @@ module.exports = {
.then(response => utils.parseResponse(item, response, config))
.then(results => {
item.programs = results
Result.events['data'](item)
cb(item, null)
programs = programs.concat(results)
})
.catch(err => {
Result.events['error'](err)
cb(null, err)
})
.finally(utils.sleep(config.delay))
await utils.sleep(config.delay)
}
Result.events['done'](programs)
}
return programs
},
convertToXMLTV: utils.convertToXMLTV
}