Fixes
This commit is contained in:
1 parent
1cf608ae4b
commit
c329525035
3 files changed
-99
No files matched your search
@@ -2,17 +2,6 @@ const dayjs = require('dayjs')
|
|||||||
const utc = require('dayjs/plugin/utc')
|
const utc = require('dayjs/plugin/utc')
|
||||||
const timezone = require('dayjs/plugin/timezone')
|
const timezone = require('dayjs/plugin/timezone')
|
||||||
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||||
const fs = require('fs')
|
|
||||||
const path = require('path')
|
|
||||||
|
|
||||||
let EPGGrabber
|
|
||||||
|
|
||||||
async function getEPGGrabber() {
|
|
||||||
if (!EPGGrabber) {
|
|
||||||
EPGGrabber = (await import('epg-grabber')).EPGGrabber
|
|
||||||
}
|
|
||||||
return EPGGrabber
|
|
||||||
}
|
|
||||||
|
|
||||||
dayjs.extend(utc)
|
dayjs.extend(utc)
|
||||||
dayjs.extend(timezone)
|
dayjs.extend(timezone)
|
||||||
@@ -26,28 +15,6 @@ const tz = {
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
site: 'rtp.pt',
|
site: 'rtp.pt',
|
||||||
channels: async () => {
|
|
||||||
const channelsPath = path.resolve(__dirname, 'rtp.pt.channels.xml')
|
|
||||||
|
|
||||||
if (!fs.existsSync(channelsPath)) {
|
|
||||||
console.warn(`Channels file not found: ${channelsPath}. Returning empty list.`)
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
|
|
||||||
const grabber = await getEPGGrabber()
|
|
||||||
const xml = fs.readFileSync(channelsPath, 'utf8')
|
|
||||||
const parsed = grabber.parseChannelsXML(xml)
|
|
||||||
|
|
||||||
return parsed.map(channel => ({
|
|
||||||
xmltv_id: channel.xmltv_id,
|
|
||||||
name: channel.name,
|
|
||||||
site_id: channel.site_id,
|
|
||||||
lang: channel.lang,
|
|
||||||
logo: channel.logo,
|
|
||||||
url: channel.url,
|
|
||||||
lcn: channel.lcn
|
|
||||||
}))
|
|
||||||
},
|
|
||||||
days: 2,
|
days: 2,
|
||||||
|
|
||||||
url({ channel, date }) {
|
url({ channel, date }) {
|
||||||
|
|||||||
@@ -1,41 +1,8 @@
|
|||||||
const dayjs = require('dayjs')
|
const dayjs = require('dayjs')
|
||||||
const cheerio = require('cheerio')
|
const cheerio = require('cheerio')
|
||||||
const fs = require('fs')
|
|
||||||
const path = require('path')
|
|
||||||
|
|
||||||
let EPGGrabber
|
|
||||||
|
|
||||||
async function getEPGGrabber() {
|
|
||||||
if (!EPGGrabber) {
|
|
||||||
EPGGrabber = (await import('epg-grabber')).EPGGrabber
|
|
||||||
}
|
|
||||||
return EPGGrabber
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
site: 'sporttv.pt',
|
site: 'sporttv.pt',
|
||||||
channels: async () => {
|
|
||||||
const channelsPath = path.resolve(__dirname, 'sporttv.pt.channels.xml')
|
|
||||||
|
|
||||||
if (!fs.existsSync(channelsPath)) {
|
|
||||||
console.warn(`Channels file not found: ${channelsPath}. Returning empty list.`)
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
|
|
||||||
const xml = fs.readFileSync(channelsPath, 'utf8')
|
|
||||||
const grabber = await getEPGGrabber()
|
|
||||||
const parsed = grabber.parseChannelsXML(xml)
|
|
||||||
|
|
||||||
return parsed.map(channel => ({
|
|
||||||
xmltv_id: channel.xmltv_id,
|
|
||||||
name: channel.name,
|
|
||||||
site_id: channel.site_id,
|
|
||||||
lang: channel.lang,
|
|
||||||
logo: channel.logo,
|
|
||||||
url: channel.url,
|
|
||||||
lcn: channel.lcn
|
|
||||||
}))
|
|
||||||
},
|
|
||||||
days: 2,
|
days: 2,
|
||||||
|
|
||||||
url: 'https://www.sporttv.pt/guia',
|
url: 'https://www.sporttv.pt/guia',
|
||||||
|
|||||||
@@ -1,16 +1,5 @@
|
|||||||
const { DateTime } = require('luxon')
|
const { DateTime } = require('luxon')
|
||||||
const axios = require('axios')
|
const axios = require('axios')
|
||||||
const fs = require('fs')
|
|
||||||
const path = require('path')
|
|
||||||
|
|
||||||
let EPGGrabber
|
|
||||||
|
|
||||||
async function getEPGGrabber() {
|
|
||||||
if (!EPGGrabber) {
|
|
||||||
EPGGrabber = (await import('epg-grabber')).EPGGrabber
|
|
||||||
}
|
|
||||||
return EPGGrabber
|
|
||||||
}
|
|
||||||
|
|
||||||
const API_ENDPOINT = 'https://cdn.pt.vtv.vodafone.com/epg'
|
const API_ENDPOINT = 'https://cdn.pt.vtv.vodafone.com/epg'
|
||||||
|
|
||||||
@@ -24,28 +13,6 @@ const headers = {
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
site: 'vodafone.pt',
|
site: 'vodafone.pt',
|
||||||
channels: async () => {
|
|
||||||
const channelsPath = path.resolve(__dirname, 'vodafone.pt.channels.xml')
|
|
||||||
|
|
||||||
if (!fs.existsSync(channelsPath)) {
|
|
||||||
console.warn(`Channels file not found: ${channelsPath}. Returning empty list.`)
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
|
|
||||||
const xml = fs.readFileSync(channelsPath, 'utf8')
|
|
||||||
const grabber = await getEPGGrabber()
|
|
||||||
const parsed = grabber.parseChannelsXML(xml)
|
|
||||||
|
|
||||||
return parsed.map(channel => ({
|
|
||||||
xmltv_id: channel.xmltv_id,
|
|
||||||
name: channel.name,
|
|
||||||
site_id: channel.site_id,
|
|
||||||
lang: channel.lang,
|
|
||||||
logo: channel.logo,
|
|
||||||
url: channel.url,
|
|
||||||
lcn: channel.lcn
|
|
||||||
}))
|
|
||||||
},
|
|
||||||
days: 2,
|
days: 2,
|
||||||
request: {
|
request: {
|
||||||
headers
|
headers
|
||||||
|
|||||||
Reference in new issue
Block a user