fix error in adding the epg-grabber module

This commit is contained in:
thomraider12
2026-03-22 10:43:32 +00:00
parent 8dfdf9ab9e
commit 23d44dcb14
3 changed files with 33 additions and 6 deletions
+11 -2
View File
@@ -2,7 +2,15 @@ const dayjs = require('dayjs')
const cheerio = require('cheerio')
const fs = require('fs')
const path = require('path')
const { EPGGrabber } = require('epg-grabber')
let EPGGrabber
async function getEPGGrabber() {
if (!EPGGrabber) {
EPGGrabber = (await import('epg-grabber')).EPGGrabber
}
return EPGGrabber
}
module.exports = {
site: 'sporttv.pt',
@@ -15,7 +23,8 @@ module.exports = {
}
const xml = fs.readFileSync(channelsPath, 'utf8')
const parsed = EPGGrabber.parseChannelsXML(xml)
const grabber = await getEPGGrabber()
const parsed = grabber.parseChannelsXML(xml)
return parsed.map(channel => ({
xmltv_id: channel.xmltv_id,