mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 09:00:07 -04:00
Create compulms.com.config.js
This commit is contained in:
parent
0d5b1f0b55
commit
43f88c932c
1 changed files with 32 additions and 0 deletions
32
sites/compulms.com/compulms.com.config.js
Normal file
32
sites/compulms.com/compulms.com.config.js
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
const parser = require('epg-parser')
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
site: 'compulms.com',
|
||||||
|
request: {
|
||||||
|
cache: {
|
||||||
|
ttl: 60 * 60 * 1000 // 1 hour
|
||||||
|
}
|
||||||
|
},
|
||||||
|
url: 'https://raw.githubusercontent.com/luisms123/tdt/master/guiaenergeek.xml',
|
||||||
|
parser: function ({ content, channel, date }) {
|
||||||
|
let programs = []
|
||||||
|
const items = parseItems(content, channel, date)
|
||||||
|
items.forEach(item => {
|
||||||
|
programs.push({
|
||||||
|
title: item.title?.[0].value,
|
||||||
|
description: item.desc?.[0].value,
|
||||||
|
icon: item.icon?.[0],
|
||||||
|
start: item.start,
|
||||||
|
stop: item.stop
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
return programs
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseItems(content, channel, date) {
|
||||||
|
const { programs } = parser.parse(content)
|
||||||
|
|
||||||
|
return programs.filter(p => p.channel === channel.site_id && date.isSame(p.start, 'day'))
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue