Update index.js

This commit is contained in:
freearhey 2021-04-17 13:28:56 +03:00
parent 0d3c550a5b
commit 52538b9359
1 changed files with 10 additions and 3 deletions

View File

@ -32,10 +32,14 @@ async function main() {
let programs = [] let programs = []
console.log('Parsing:') console.log('Parsing:')
for (let item of queue) { for (let item of queue) {
if (options.debug) console.time(' Time') if (options.debug) console.time(' Response Time')
const progs = await utils const progs = await utils
.fetchData(item, config) .fetchData(item, config)
.then(response => { .then(response => {
if (options.debug) {
console.timeEnd(' Response Time')
console.time(' Parsing Time')
}
if (!item.channel.logo && config.logo) { if (!item.channel.logo && config.logo) {
item.channel.logo = config.logo({ item.channel.logo = config.logo({
channel: item.channel, channel: item.channel,
@ -57,7 +61,7 @@ async function main() {
}) })
}) })
.then(() => { .then(() => {
if (options.debug) console.timeEnd(' Time') if (options.debug) console.timeEnd(' Parsing Time')
}) })
.then(utils.sleep(config.delay)) .then(utils.sleep(config.delay))
.catch(err => { .catch(err => {
@ -67,7 +71,10 @@ async function main() {
)} (0 programs)` )} (0 programs)`
) )
console.log(` Error: ${err.message}`) console.log(` Error: ${err.message}`)
if (options.debug) console.timeEnd(' Time') if (options.debug) {
console.timeEnd(' Response Time')
console.timeEnd(' Parsing Time')
}
}) })
programs = programs.concat(progs) programs = programs.concat(progs)