mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-11 09:30:06 -04:00
Added guide from comteco.com.bo
This commit is contained in:
parent
dfaee2190c
commit
8300d81575
4 changed files with 167 additions and 0 deletions
64
sites/comteco.com.bo.config.js
Normal file
64
sites/comteco.com.bo.config.js
Normal file
|
@ -0,0 +1,64 @@
|
|||
const jsdom = require('jsdom')
|
||||
const { JSDOM } = jsdom
|
||||
const dayjs = require('dayjs')
|
||||
const utc = require('dayjs/plugin/utc')
|
||||
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||
|
||||
dayjs.extend(utc)
|
||||
dayjs.extend(customParseFormat)
|
||||
|
||||
module.exports = {
|
||||
lang: 'es',
|
||||
site: 'comteco.com.bo',
|
||||
channels: 'comteco.com.bo.channels.xml',
|
||||
output: '.gh-pages/guides/comteco.com.bo.guide.xml',
|
||||
url: function ({ channel }) {
|
||||
return `https://comteco.com.bo/pages/canales-y-programacion-tv/paquete-oro/${encodeURI(
|
||||
channel.site_id
|
||||
)}`
|
||||
},
|
||||
logo: function ({ content }) {
|
||||
const dom = new JSDOM(content)
|
||||
const img = dom.window.document.querySelector(
|
||||
'#myform > div.row > div:nth-child(1) > div.col-xs-5.col-sm-7 > img'
|
||||
)
|
||||
|
||||
return img ? `https://comteco.com.bo${img.src}` : null
|
||||
},
|
||||
parser: function ({ content, date }) {
|
||||
const programs = []
|
||||
const dom = new JSDOM(content)
|
||||
const items = dom.window.document.querySelectorAll('#datosasociados > div > .list-group-item')
|
||||
items.forEach(item => {
|
||||
const time = (
|
||||
item.querySelector('div > div.col-xs-11 > p > span') || { textContent: '' }
|
||||
).textContent
|
||||
.toString()
|
||||
.trim()
|
||||
const title = (
|
||||
item.querySelector('div > div.col-xs-11 > p > strong') || { textContent: '' }
|
||||
).textContent
|
||||
.toString()
|
||||
.trim()
|
||||
|
||||
if (time && title) {
|
||||
const start = dayjs
|
||||
.utc(time, 'HH:mm:ss')
|
||||
.set('D', date.get('D'))
|
||||
.set('M', date.get('M'))
|
||||
.set('y', date.get('y'))
|
||||
|
||||
if (programs.length && !programs[programs.length - 1].stop) {
|
||||
programs[programs.length - 1].stop = start
|
||||
}
|
||||
|
||||
programs.push({
|
||||
title,
|
||||
start: start.toString()
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
return programs
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue