mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-09 16:40:07 -04:00
Update grab.js
This commit is contained in:
parent
970c0d40ea
commit
1c654e3b96
1 changed files with 5 additions and 7 deletions
|
@ -31,8 +31,10 @@ async function main() {
|
|||
for (let channel of channels) {
|
||||
const configPath = `sites/${channel.site}.config.js`
|
||||
const config = require(path.resolve(configPath))
|
||||
await grabber.grab(channel, config, result => {
|
||||
result.on('data', function (item) {
|
||||
await grabber.grab(channel, config, (item, err) => {
|
||||
if (err) {
|
||||
console.log(` Error: ${err.message}`)
|
||||
} else {
|
||||
console.log(
|
||||
` ${item.channel.site} - ${item.channel.xmltv_id} - ${item.date.format(
|
||||
'MMM D, YYYY'
|
||||
|
@ -40,11 +42,7 @@ async function main() {
|
|||
)
|
||||
|
||||
programs = programs.concat(item.programs)
|
||||
})
|
||||
|
||||
result.on('error', function (err) {
|
||||
console.log(` Error: ${err.message}`)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue