mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
parent
8b4e6fe786
commit
ea42d168a5
4 changed files with 1374 additions and 0 deletions
1293
sites/energeek.cl/__data__/content.xml
Normal file
1293
sites/energeek.cl/__data__/content.xml
Normal file
File diff suppressed because it is too large
Load diff
9
sites/energeek.cl/energeek.cl.channels.xml
Normal file
9
sites/energeek.cl/energeek.cl.channels.xml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<channels>
|
||||||
|
<channel site="energeek.cl" lang="es" xmltv_id="" site_id="EnerGeek 4">EnerGeek 4</channel>
|
||||||
|
<channel site="energeek.cl" lang="es" xmltv_id="" site_id="EnerGeek Fanpop">EnerGeek Fanpop</channel>
|
||||||
|
<channel site="energeek.cl" lang="es" xmltv_id="" site_id="EnerGeek Retro">EnerGeek Retro</channel>
|
||||||
|
<channel site="energeek.cl" lang="es" xmltv_id="CCPRadio.cl" site_id="CCP Radio">CCP Radio</channel>
|
||||||
|
<channel site="energeek.cl" lang="es" xmltv_id="EnerGeekRadio.cl" site_id="EnerGeek Radio TV">EnerGeek Radio TV</channel>
|
||||||
|
<channel site="energeek.cl" lang="es" xmltv_id="FanpopTV.cl" site_id="Fanpop TV">Fanpop TV</channel>
|
||||||
|
</channels>
|
33
sites/energeek.cl/energeek.cl.config.js
Normal file
33
sites/energeek.cl/energeek.cl.config.js
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
const parser = require('epg-parser')
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
site: 'energeek.cl',
|
||||||
|
days: 2,
|
||||||
|
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'))
|
||||||
|
}
|
39
sites/energeek.cl/energeek.cl.test.js
Normal file
39
sites/energeek.cl/energeek.cl.test.js
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
// npm run grab -- --site=energeek.cl
|
||||||
|
|
||||||
|
const { parser, url } = require('./energeek.cl.config.js')
|
||||||
|
const fs = require('fs')
|
||||||
|
const path = require('path')
|
||||||
|
const dayjs = require('dayjs')
|
||||||
|
const utc = require('dayjs/plugin/utc')
|
||||||
|
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||||
|
dayjs.extend(customParseFormat)
|
||||||
|
dayjs.extend(utc)
|
||||||
|
|
||||||
|
const date = dayjs.utc('2022-11-29', 'YYYY-MM-DD').startOf('d')
|
||||||
|
const channel = {
|
||||||
|
site_id: 'EnerGeek Retro',
|
||||||
|
xmltv_id: 'EnerGeekRetro.cl'
|
||||||
|
}
|
||||||
|
|
||||||
|
it('can generate valid url', () => {
|
||||||
|
expect(url).toBe('https://raw.githubusercontent.com/luisms123/tdt/master/guiaenergeek.xml')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('can parse response', () => {
|
||||||
|
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.xml'))
|
||||||
|
let results = parser({ content, channel, date })
|
||||||
|
|
||||||
|
expect(results[0]).toMatchObject({
|
||||||
|
start: '2022-11-29T03:00:00.000Z',
|
||||||
|
stop: '2022-11-29T03:30:00.000Z',
|
||||||
|
title: 'Noir',
|
||||||
|
description:
|
||||||
|
'Kirika Yuumura es una adolescente japonesa que no recuerda nada de su pasado, salvo la palabra NOIR, por lo que decidirá contactar con Mireille Bouquet, una asesina profesional para que la ayude a investigar. Ambas forman un equipo muy eficiente, que resuelve un trabajo tras otro con gran éxito, hasta que aparece un grupo conocido como "Les Soldats", relacionados con el pasado de Kirika. Estos tratarán de eliminar a las dos chicas, antes de que indaguen más hondo sobre la verdad acerca de Noir',
|
||||||
|
icon: 'https://pics.filmaffinity.com/nowaru_noir_tv_series-225888552-mmed.jpg'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('can handle empty guide', () => {
|
||||||
|
const result = parser({ content: '', channel, date })
|
||||||
|
expect(result).toMatchObject([])
|
||||||
|
})
|
Loading…
Add table
Add a link
Reference in a new issue