mirror of
https://github.com/iptv-org/epg
synced 2025-12-16 02:16:40 -05:00
fix mi.tv image scraping, continue uniformizing tests
This commit is contained in:
1
sites/mi.tv/__data__/content.html
Normal file
1
sites/mi.tv/__data__/content.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<div id="listings"> <div class="channel-info"> <img src="https://cdn.mitvstatic.com/channels/ar_24-7-canal-de-noticias_m.png" alt="Programación 24/7 Canal de Noticias" title="24/7 Canal de Noticias" width="75" height="75"/> <h1>Programación 24/7 Canal de Noticias <span>Miércoles 24 de noviembre</span></h1> </div><ul class="broadcasts time24"> <li> <a href="/ar/programas/trasnoche-de-24-7" class="program-link"> <div class="image-parent"> <div class="image" style=" background-image: url(\'https://cdn.mitvstatic.com/programs/fallback_other_l_m.jpg\'); " ></div></div><div class="content"> <span class="time">03:00</span> <h2>Trasnoche de 24/7</h2> <span class="sub-title">Interés general</span> <p class="synopsis">Lo más visto de la semana en nuestra pantalla.</p></div></a> </li><li class="native"> <div id="div-gpt-ad-1586617865827-0"></div></li><li> <a href="/ar/programas/noticiero-central-segunda-edicion" class="program-link"> <div class="image-parent"> <div class="image" style=" background-image: url(\'https://cdn.mitvstatic.com/programs/fallback_other_l_m.jpg\'); " ></div></div><div class="content"> <span class="time">23:00</span> <h2>Noticiero central - Segunda edición</h2> <span class="sub-title">Noticiero</span> <p class="synopsis"> Cerramos el día con un completo resumen de los temas más relevantes con columnistas y análisis especiales para terminar el día. </p></div></a> </li><li> <a href="/ar/programas/plus-energetico" class="program-link"> <div class="image-parent"> <div class="image" style=" background-image: url(\'https://cdn.mitvstatic.com/programs/fallback_other_l_m.jpg\'); " ></div></div><div class="content"> <span class="time">01:00</span> <h2>Plus energético</h2> <span class="sub-title">Cultural</span> <p class="synopsis"> La energía tiene mucho para mostrar. Este programa reúne a las principales empresas y protagonistas de la actividad que esta revolucionando la región. </p></div></a> </li></ul></div>
|
||||||
1
sites/mi.tv/__data__/no_content.html
Normal file
1
sites/mi.tv/__data__/no_content.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<!DOCTYPE html><html><head></head><body></body></html>
|
||||||
@@ -102,13 +102,41 @@ function parseDescription($item) {
|
|||||||
return $item('a > div.content > p.synopsis').text().trim()
|
return $item('a > div.content > p.synopsis').text().trim()
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseImage($item) {
|
|
||||||
const backgroundImage = $item('a > div.image-parent > div.image').css('background-image')
|
|
||||||
const [, image] = backgroundImage.match(/url\('(.*)'\)/) || [null, null]
|
|
||||||
|
|
||||||
return image
|
function parseImage($item) {
|
||||||
|
const styleAttr = $item('a > div.image-parent > div.image').attr('style')
|
||||||
|
|
||||||
|
if (styleAttr) {
|
||||||
|
const match = styleAttr.match(/background-image:\s*url\(['"]?(.*?)['"]?\)/)
|
||||||
|
if (match) {
|
||||||
|
return cleanUrl(match[1])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const backgroundImage = $item('a > div.image-parent > div.image').css('background-image')
|
||||||
|
|
||||||
|
if (backgroundImage && backgroundImage !== 'none') {
|
||||||
|
const match = backgroundImage.match(/url\(['"]?(.*?)['"]?\)/)
|
||||||
|
if (match) {
|
||||||
|
return cleanUrl(match[1])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function cleanUrl(url) {
|
||||||
|
if (!url) return null
|
||||||
|
|
||||||
|
return url
|
||||||
|
.replace(/^['"`\\]+/, '')
|
||||||
|
.replace(/['"`\\]+$/, '')
|
||||||
|
.replace(/\\'/g, "'")
|
||||||
|
.replace(/\\"/g, '"')
|
||||||
|
.replace(/\\\\/g, '\\')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function parseItems(content) {
|
function parseItems(content) {
|
||||||
const $ = cheerio.load(content)
|
const $ = cheerio.load(content)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
const { parser, url } = require('./mi.tv.config.js')
|
const { parser, url } = require('./mi.tv.config.js')
|
||||||
|
const fs = require('fs')
|
||||||
|
const path = require('path')
|
||||||
const dayjs = require('dayjs')
|
const dayjs = require('dayjs')
|
||||||
const utc = require('dayjs/plugin/utc')
|
const utc = require('dayjs/plugin/utc')
|
||||||
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||||
@@ -10,8 +12,6 @@ const channel = {
|
|||||||
site_id: 'ar#24-7-canal-de-noticias',
|
site_id: 'ar#24-7-canal-de-noticias',
|
||||||
xmltv_id: '247CanaldeNoticias.ar'
|
xmltv_id: '247CanaldeNoticias.ar'
|
||||||
}
|
}
|
||||||
const content =
|
|
||||||
'<div id="listings"> <div class="channel-info"> <img src="https://cdn.mitvstatic.com/channels/ar_24-7-canal-de-noticias_m.png" alt="Programación 24/7 Canal de Noticias" title="24/7 Canal de Noticias" width="75" height="75"/> <h1>Programación 24/7 Canal de Noticias <span>Miércoles 24 de noviembre</span></h1> </div><ul class="broadcasts time24"> <li> <a href="/ar/programas/trasnoche-de-24-7" class="program-link"> <div class="image-parent"> <div class="image" style=" background-image: url(\'https://cdn.mitvstatic.com/programs/fallback_other_l_m.jpg\'); " ></div></div><div class="content"> <span class="time">03:00</span> <h2>Trasnoche de 24/7</h2> <span class="sub-title">Interés general</span> <p class="synopsis">Lo más visto de la semana en nuestra pantalla.</p></div></a> </li><li class="native"> <div id="div-gpt-ad-1586617865827-0"></div></li><li> <a href="/ar/programas/noticiero-central-segunda-edicion" class="program-link"> <div class="image-parent"> <div class="image" style=" background-image: url(\'https://cdn.mitvstatic.com/programs/fallback_other_l_m.jpg\'); " ></div></div><div class="content"> <span class="time">23:00</span> <h2>Noticiero central - Segunda edición</h2> <span class="sub-title">Noticiero</span> <p class="synopsis"> Cerramos el día con un completo resumen de los temas más relevantes con columnistas y análisis especiales para terminar el día. </p></div></a> </li><li> <a href="/ar/programas/plus-energetico" class="program-link"> <div class="image-parent"> <div class="image" style=" background-image: url(\'https://cdn.mitvstatic.com/programs/fallback_other_l_m.jpg\'); " ></div></div><div class="content"> <span class="time">01:00</span> <h2>Plus energético</h2> <span class="sub-title">Cultural</span> <p class="synopsis"> La energía tiene mucho para mostrar. Este programa reúne a las principales empresas y protagonistas de la actividad que esta revolucionando la región. </p></div></a> </li></ul></div>'
|
|
||||||
|
|
||||||
it('can generate valid url', () => {
|
it('can generate valid url', () => {
|
||||||
expect(url({ channel, date })).toBe(
|
expect(url({ channel, date })).toBe(
|
||||||
@@ -20,6 +20,7 @@ it('can generate valid url', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('can parse response', () => {
|
it('can parse response', () => {
|
||||||
|
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.html'), 'utf8')
|
||||||
const result = parser({ content, date }).map(p => {
|
const result = parser({ content, date }).map(p => {
|
||||||
p.start = p.start.toJSON()
|
p.start = p.start.toJSON()
|
||||||
p.stop = p.stop.toJSON()
|
p.stop = p.stop.toJSON()
|
||||||
@@ -60,7 +61,7 @@ it('can handle empty guide', () => {
|
|||||||
const result = parser({
|
const result = parser({
|
||||||
date,
|
date,
|
||||||
channel,
|
channel,
|
||||||
content: '<!DOCTYPE html><html><head></head><body></body></html>'
|
content: ''
|
||||||
})
|
})
|
||||||
expect(result).toMatchObject([])
|
expect(result).toMatchObject([])
|
||||||
})
|
})
|
||||||
|
|||||||
1
sites/moji.id/__data__/content.html
Normal file
1
sites/moji.id/__data__/content.html
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
sites/mysky.com.ph/__data__/content.json
Normal file
1
sites/mysky.com.ph/__data__/content.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"events":[{"name":"TV PATROL","location":"8","start":"2022/10/04 19:00","end":"2022/10/04 20:00","userData":{"description":"Description example"}},{"name":"DARNA","location":"8","start":"2022/10/05 20:00","end":"2022/10/05 20:45","userData":{"description":""}},{"name":"Zoe Bakes S1","location":"22","start":"2022/10/04 20:30","end":"2022/10/04 21:00","userData":{"description":"Zo Franois Dad is a beekeeper. So for his birthday, she bakes him a special beehiveshaped cake."}}]}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
const { parser, url } = require('./mysky.com.ph.config.js')
|
const { parser, url } = require('./mysky.com.ph.config.js')
|
||||||
|
const fs = require('fs')
|
||||||
|
const path = require('path')
|
||||||
const dayjs = require('dayjs')
|
const dayjs = require('dayjs')
|
||||||
const utc = require('dayjs/plugin/utc')
|
const utc = require('dayjs/plugin/utc')
|
||||||
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||||
@@ -16,8 +18,7 @@ it('can generate valid url', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('can parse response', () => {
|
it('can parse response', () => {
|
||||||
const content =
|
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json'))
|
||||||
'{"events":[{"name":"TV PATROL","location":"8","start":"2022/10/04 19:00","end":"2022/10/04 20:00","userData":{"description":"Description example"}},{"name":"DARNA","location":"8","start":"2022/10/05 20:00","end":"2022/10/05 20:45","userData":{"description":""}},{"name":"Zoe Bakes S1","location":"22","start":"2022/10/04 20:30","end":"2022/10/04 21:00","userData":{"description":"Zo Franois Dad is a beekeeper. So for his birthday, she bakes him a special beehiveshaped cake."}}]}'
|
|
||||||
const result = parser({ content, channel, date }).map(p => {
|
const result = parser({ content, channel, date }).map(p => {
|
||||||
p.start = p.start.toJSON()
|
p.start = p.start.toJSON()
|
||||||
p.stop = p.stop.toJSON()
|
p.stop = p.stop.toJSON()
|
||||||
|
|||||||
64
sites/neo.io/__data__/content.json
Normal file
64
sites/neo.io/__data__/content.json
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
{
|
||||||
|
"shows": [
|
||||||
|
{
|
||||||
|
"title": "Napovedujemo",
|
||||||
|
"show_start": 1735185900,
|
||||||
|
"show_end": 1735192200,
|
||||||
|
"timestamp": "5:05 - 6:50",
|
||||||
|
"show_id": "CUP_IECOM_SLO1_10004660",
|
||||||
|
"thumbnail": "https://ngimg.siol.tv/sioltv/mtcmsprod/52/0/0/5200d01a-fe5f-487e-835a-274e77227a6b.jpg",
|
||||||
|
"is_adult": false,
|
||||||
|
"friendly_id": "napovedujemo_db48",
|
||||||
|
"pg": "",
|
||||||
|
"genres": [
|
||||||
|
"napovednik"
|
||||||
|
],
|
||||||
|
"year": 0,
|
||||||
|
"summary": "Vabilo k ogledu naših oddaj.",
|
||||||
|
"categories": "Ostalo",
|
||||||
|
"stb_only": false,
|
||||||
|
"is_live": false,
|
||||||
|
"original_title": "Napovedujemo"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "S0E0 - Hrabri zajčki: Prvi sneg",
|
||||||
|
"show_start": 1735192200,
|
||||||
|
"show_end": 1735192800,
|
||||||
|
"timestamp": "6:50 - 7:00",
|
||||||
|
"show_id": "CUP_IECOM_SLO1_79637910",
|
||||||
|
"thumbnail": "https://ngimg.siol.tv/sioltv/mtcmsprod/d6/4/5/d6456f4a-4f0a-4825-90c1-1749abd59688.jpg",
|
||||||
|
"is_adult": false,
|
||||||
|
"friendly_id": "hrabri_zajcki_prvi_sneg_1619",
|
||||||
|
"pg": "",
|
||||||
|
"genres": [
|
||||||
|
"risanka"
|
||||||
|
],
|
||||||
|
"year": 2020,
|
||||||
|
"summary": "Hrabri zajčki so prispeli v borov gozd in izkusili prvi sneg. Bob in Bu še nikoli nista videla snega. Mami kuha korenčkov kakav, Bu in Bob pa kmalu spoznata novega prijatelja, losa Danija.",
|
||||||
|
"categories": "Otroški/Mladinski",
|
||||||
|
"stb_only": false,
|
||||||
|
"is_live": false,
|
||||||
|
"original_title": "S0E0 - Brave Bunnies"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Dobro jutro",
|
||||||
|
"show_start": 1735192800,
|
||||||
|
"show_end": 1735203900,
|
||||||
|
"timestamp": "7:00 - 10:05",
|
||||||
|
"show_id": "CUP_IECOM_SLO1_79637911",
|
||||||
|
"thumbnail": "https://ngimg.siol.tv/sioltv/mtcmsprod/e1/2/d/e12d8eb4-693a-43d3-89d4-fd96dade9f0f.jpg",
|
||||||
|
"is_adult": false,
|
||||||
|
"friendly_id": "dobro_jutro_2f10",
|
||||||
|
"pg": "",
|
||||||
|
"genres": [
|
||||||
|
"zabavna oddaja"
|
||||||
|
],
|
||||||
|
"year": 2024,
|
||||||
|
"summary": "Oddaja Dobro jutro poleg informativnih in zabavnih vsebin podaja koristne nasvete o najrazličnejših tematikah iz vsakdanjega življenja.",
|
||||||
|
"categories": "Razvedrilni program",
|
||||||
|
"stb_only": false,
|
||||||
|
"is_live": false,
|
||||||
|
"original_title": "Dobro jutro"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
1
sites/neo.io/__data__/no_content.json
Normal file
1
sites/neo.io/__data__/no_content.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"shows":[]}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
const { parser, url } = require('./neo.io.config.js')
|
const { parser, url } = require('./neo.io.config.js')
|
||||||
|
const fs = require('fs')
|
||||||
|
const path = require('path')
|
||||||
const dayjs = require('dayjs')
|
const dayjs = require('dayjs')
|
||||||
const utc = require('dayjs/plugin/utc')
|
const utc = require('dayjs/plugin/utc')
|
||||||
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||||
@@ -18,72 +20,7 @@ it('can generate valid url', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('can parse response', () => {
|
it('can parse response', () => {
|
||||||
const content = `
|
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json'))
|
||||||
{
|
|
||||||
"shows": [
|
|
||||||
{
|
|
||||||
"title": "Napovedujemo",
|
|
||||||
"show_start": 1735185900,
|
|
||||||
"show_end": 1735192200,
|
|
||||||
"timestamp": "5:05 - 6:50",
|
|
||||||
"show_id": "CUP_IECOM_SLO1_10004660",
|
|
||||||
"thumbnail": "https://ngimg.siol.tv/sioltv/mtcmsprod/52/0/0/5200d01a-fe5f-487e-835a-274e77227a6b.jpg",
|
|
||||||
"is_adult": false,
|
|
||||||
"friendly_id": "napovedujemo_db48",
|
|
||||||
"pg": "",
|
|
||||||
"genres": [
|
|
||||||
"napovednik"
|
|
||||||
],
|
|
||||||
"year": 0,
|
|
||||||
"summary": "Vabilo k ogledu naših oddaj.",
|
|
||||||
"categories": "Ostalo",
|
|
||||||
"stb_only": false,
|
|
||||||
"is_live": false,
|
|
||||||
"original_title": "Napovedujemo"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "S0E0 - Hrabri zajčki: Prvi sneg",
|
|
||||||
"show_start": 1735192200,
|
|
||||||
"show_end": 1735192800,
|
|
||||||
"timestamp": "6:50 - 7:00",
|
|
||||||
"show_id": "CUP_IECOM_SLO1_79637910",
|
|
||||||
"thumbnail": "https://ngimg.siol.tv/sioltv/mtcmsprod/d6/4/5/d6456f4a-4f0a-4825-90c1-1749abd59688.jpg",
|
|
||||||
"is_adult": false,
|
|
||||||
"friendly_id": "hrabri_zajcki_prvi_sneg_1619",
|
|
||||||
"pg": "",
|
|
||||||
"genres": [
|
|
||||||
"risanka"
|
|
||||||
],
|
|
||||||
"year": 2020,
|
|
||||||
"summary": "Hrabri zajčki so prispeli v borov gozd in izkusili prvi sneg. Bob in Bu še nikoli nista videla snega. Mami kuha korenčkov kakav, Bu in Bob pa kmalu spoznata novega prijatelja, losa Danija.",
|
|
||||||
"categories": "Otroški/Mladinski",
|
|
||||||
"stb_only": false,
|
|
||||||
"is_live": false,
|
|
||||||
"original_title": "S0E0 - Brave Bunnies"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Dobro jutro",
|
|
||||||
"show_start": 1735192800,
|
|
||||||
"show_end": 1735203900,
|
|
||||||
"timestamp": "7:00 - 10:05",
|
|
||||||
"show_id": "CUP_IECOM_SLO1_79637911",
|
|
||||||
"thumbnail": "https://ngimg.siol.tv/sioltv/mtcmsprod/e1/2/d/e12d8eb4-693a-43d3-89d4-fd96dade9f0f.jpg",
|
|
||||||
"is_adult": false,
|
|
||||||
"friendly_id": "dobro_jutro_2f10",
|
|
||||||
"pg": "",
|
|
||||||
"genres": [
|
|
||||||
"zabavna oddaja"
|
|
||||||
],
|
|
||||||
"year": 2024,
|
|
||||||
"summary": "Oddaja Dobro jutro poleg informativnih in zabavnih vsebin podaja koristne nasvete o najrazličnejših tematikah iz vsakdanjega življenja.",
|
|
||||||
"categories": "Razvedrilni program",
|
|
||||||
"stb_only": false,
|
|
||||||
"is_live": false,
|
|
||||||
"original_title": "Dobro jutro"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}`
|
|
||||||
|
|
||||||
const result = parser({ content, channel })
|
const result = parser({ content, channel })
|
||||||
|
|
||||||
expect(result).toMatchObject([
|
expect(result).toMatchObject([
|
||||||
@@ -118,7 +55,7 @@ it('can parse response', () => {
|
|||||||
|
|
||||||
it('can handle empty guide', () => {
|
it('can handle empty guide', () => {
|
||||||
const result = parser({
|
const result = parser({
|
||||||
content: '{"shows":[]}'
|
content: fs.readFileSync(path.resolve(__dirname, '__data__/no_content.json'))
|
||||||
})
|
})
|
||||||
expect(result).toMatchObject([])
|
expect(result).toMatchObject([])
|
||||||
})
|
})
|
||||||
|
|||||||
1
sites/novacyprus.com/__data__/content.json
Normal file
1
sites/novacyprus.com/__data__/content.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"nodes":[{"datetime":"2021-11-17 06:20:00","day":"Wednesday","numDay":17,"numMonth":11,"month":"November","channelName":"Cyprus Novacinema1HD","channelLog":"https://ssl2.novago.gr/EPG/jsp/images/universal/film/logo/20200210/000100/XTV100000762/d6a2f5e0-dbc0-49c7-9843-e3161ca5ae5d.png","cid":"42","ChannelId":"614","startingTime":"06:20","endTime":"08:10","title":"Δεσμοί Αίματος","description":"Θρίλερ Μυστηρίου","duration":"109","slotDuration":"110","bref":"COMMOBLOOX","mediaItems":[{"MediaListTypeId":"6","CdnUrl":"http://cache-forthnet.secure.footprint.net/linear/3/0/305608_COMMOBLOOX_GUIDE_STILL.jpg"},{"MediaListTypeId":"7","CdnUrl":"http://cache-forthnet.secure.footprint.net/linear/3/0/305608_COMMOBLOOX_POSTER_CROSS.jpg"},{"MediaListTypeId":"8","CdnUrl":"http://cache-forthnet.secure.footprint.net/linear/3/0/305608_COMMOBLOOX_ICON_CYP.jpg"},{"MediaListTypeId":"9","CdnUrl":"http://cache-forthnet.secure.footprint.net/linear/3/0/305608_COMMOBLOOX_POSTER_CYP.jpg"},{"MediaListTypeId":"10","CdnUrl":"http://cache-forthnet.secure.footprint.net/linear/3/0/305608_COMMOBLOOX_BACKGROUND_CYP.jpg"}]},{"datetime":"2021-11-17 06:00:00","day":"Wednesday","numDay":17,"numMonth":11,"month":"November","channelName":"Cyprus Novacinema2HD","channelLog":"https://ssl2.novago.gr/EPG/jsp/images/universal/film/logo/20200210/000100/XTV100000763/24e05354-d6ad-4949-bcb3-a81d1c1d2cba.png","cid":"62","ChannelId":"653","startingTime":"06:00","endTime":"07:40","title":"Ανυπόφοροι Γείτονες","description":"Κωμωδία","duration":"93","slotDuration":"100","bref":"NEIGHBORSX","mediaItems":[{"MediaListTypeId":"7","CdnUrl":"http://cache-forthnet.secure.footprint.net/linear/3/1/312582_NEIGHBORSX_POSTER_CROSS.jpg"},{"MediaListTypeId":"8","CdnUrl":"http://cache-forthnet.secure.footprint.net/linear/3/1/312582_NEIGHBORSX_ICON_CYP.jpg"},{"MediaListTypeId":"9","CdnUrl":"http://cache-forthnet.secure.footprint.net/linear/3/1/312582_NEIGHBORSX_POSTER_CYP.jpg"},{"MediaListTypeId":"10","CdnUrl":"http://cache-forthnet.secure.footprint.net/linear/3/1/312582_NEIGHBORSX_BACKGROUND_CYP.jpg"}]}]}
|
||||||
1
sites/novacyprus.com/__data__/no_content.json
Normal file
1
sites/novacyprus.com/__data__/no_content.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"nodes":[],"total":0,"pages":0}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
const { parser, url } = require('./novacyprus.com.config.js')
|
const { parser, url } = require('./novacyprus.com.config.js')
|
||||||
|
const fs = require('fs')
|
||||||
|
const path = require('path')
|
||||||
const dayjs = require('dayjs')
|
const dayjs = require('dayjs')
|
||||||
const utc = require('dayjs/plugin/utc')
|
const utc = require('dayjs/plugin/utc')
|
||||||
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||||
@@ -18,8 +20,7 @@ it('can generate valid url', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('can parse response', () => {
|
it('can parse response', () => {
|
||||||
const content =
|
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json'))
|
||||||
'{"nodes":[{"datetime":"2021-11-17 06:20:00","day":"Wednesday","numDay":17,"numMonth":11,"month":"November","channelName":"Cyprus Novacinema1HD","channelLog":"https://ssl2.novago.gr/EPG/jsp/images/universal/film/logo/20200210/000100/XTV100000762/d6a2f5e0-dbc0-49c7-9843-e3161ca5ae5d.png","cid":"42","ChannelId":"614","startingTime":"06:20","endTime":"08:10","title":"Δεσμοί Αίματος","description":"Θρίλερ Μυστηρίου","duration":"109","slotDuration":"110","bref":"COMMOBLOOX","mediaItems":[{"MediaListTypeId":"6","CdnUrl":"http://cache-forthnet.secure.footprint.net/linear/3/0/305608_COMMOBLOOX_GUIDE_STILL.jpg"},{"MediaListTypeId":"7","CdnUrl":"http://cache-forthnet.secure.footprint.net/linear/3/0/305608_COMMOBLOOX_POSTER_CROSS.jpg"},{"MediaListTypeId":"8","CdnUrl":"http://cache-forthnet.secure.footprint.net/linear/3/0/305608_COMMOBLOOX_ICON_CYP.jpg"},{"MediaListTypeId":"9","CdnUrl":"http://cache-forthnet.secure.footprint.net/linear/3/0/305608_COMMOBLOOX_POSTER_CYP.jpg"},{"MediaListTypeId":"10","CdnUrl":"http://cache-forthnet.secure.footprint.net/linear/3/0/305608_COMMOBLOOX_BACKGROUND_CYP.jpg"}]},{"datetime":"2021-11-17 06:00:00","day":"Wednesday","numDay":17,"numMonth":11,"month":"November","channelName":"Cyprus Novacinema2HD","channelLog":"https://ssl2.novago.gr/EPG/jsp/images/universal/film/logo/20200210/000100/XTV100000763/24e05354-d6ad-4949-bcb3-a81d1c1d2cba.png","cid":"62","ChannelId":"653","startingTime":"06:00","endTime":"07:40","title":"Ανυπόφοροι Γείτονες","description":"Κωμωδία","duration":"93","slotDuration":"100","bref":"NEIGHBORSX","mediaItems":[{"MediaListTypeId":"7","CdnUrl":"http://cache-forthnet.secure.footprint.net/linear/3/1/312582_NEIGHBORSX_POSTER_CROSS.jpg"},{"MediaListTypeId":"8","CdnUrl":"http://cache-forthnet.secure.footprint.net/linear/3/1/312582_NEIGHBORSX_ICON_CYP.jpg"},{"MediaListTypeId":"9","CdnUrl":"http://cache-forthnet.secure.footprint.net/linear/3/1/312582_NEIGHBORSX_POSTER_CYP.jpg"},{"MediaListTypeId":"10","CdnUrl":"http://cache-forthnet.secure.footprint.net/linear/3/1/312582_NEIGHBORSX_BACKGROUND_CYP.jpg"}]}]}'
|
|
||||||
const result = parser({ content, channel }).map(p => {
|
const result = parser({ content, channel }).map(p => {
|
||||||
p.start = p.start.toJSON()
|
p.start = p.start.toJSON()
|
||||||
p.stop = p.stop.toJSON()
|
p.stop = p.stop.toJSON()
|
||||||
@@ -42,7 +43,7 @@ it('can handle empty guide', () => {
|
|||||||
const result = parser({
|
const result = parser({
|
||||||
date,
|
date,
|
||||||
channel,
|
channel,
|
||||||
content: '{"nodes":[],"total":0,"pages":0}'
|
content: fs.readFileSync(path.resolve(__dirname, '__data__/no_content.json'))
|
||||||
})
|
})
|
||||||
expect(result).toMatchObject([])
|
expect(result).toMatchObject([])
|
||||||
})
|
})
|
||||||
|
|||||||
1
sites/nowplayer.now.com/__data__/content.json
Normal file
1
sites/nowplayer.now.com/__data__/content.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
[[{"key":"key_202111174524739","vimProgramId":"202111174524739","name":"ViuTVsix Station Closing","start":1637690400000,"end":1637715600000,"date":"20211124","startTime":"02:00AM","endTime":"09:00AM","duration":420,"recordable":false,"restartTv":false,"npvrProg":false,"npvrStartTime":0,"npvrEndTime":0,"cid":"viutvsix station closing","cc":"","isInWatchlist":false}]]
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
const { parser, url, request } = require('./nowplayer.now.com.config.js')
|
const { parser, url, request } = require('./nowplayer.now.com.config.js')
|
||||||
|
const fs = require('fs')
|
||||||
|
const path = require('path')
|
||||||
const dayjs = require('dayjs')
|
const dayjs = require('dayjs')
|
||||||
const utc = require('dayjs/plugin/utc')
|
const utc = require('dayjs/plugin/utc')
|
||||||
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||||
@@ -32,8 +34,7 @@ it('can generate valid request headers', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('can parse response', () => {
|
it('can parse response', () => {
|
||||||
const content =
|
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json'))
|
||||||
'[[{"key":"key_202111174524739","vimProgramId":"202111174524739","name":"ViuTVsix Station Closing","start":1637690400000,"end":1637715600000,"date":"20211124","startTime":"02:00AM","endTime":"09:00AM","duration":420,"recordable":false,"restartTv":false,"npvrProg":false,"npvrStartTime":0,"npvrEndTime":0,"cid":"viutvsix station closing","cc":"","isInWatchlist":false}]]'
|
|
||||||
const result = parser({ content }).map(p => {
|
const result = parser({ content }).map(p => {
|
||||||
p.start = p.start.toJSON()
|
p.start = p.start.toJSON()
|
||||||
p.stop = p.stop.toJSON()
|
p.stop = p.stop.toJSON()
|
||||||
|
|||||||
1
sites/ontvtonight.com/__data__/content.html
Normal file
1
sites/ontvtonight.com/__data__/content.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<!DOCTYPE html><html lang="en-AU" xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml"> <head> </head> <body> <div id="wrapper"> <section id="content"> <div class="container"> <div class="row"> <div class="span6"> <img src="https://otv-us-web.s3-us-west-2.amazonaws.com/logos/guide/media/ed49cf4f-1123-4bee-9c90-a6af375af310.png" border="0" align="right" alt="7TWO" width="140"/> <table class="table table-hover"> <tbody> <tr> <td width="90"> <h5 class="thin">12:10 am</h5> </td><td> <h5 class="thin"> <a href="https://www.ontvtonight.com/au/guide/listings/programme?cid=1692&sid=165632&dt=2021-11-24+13%3A10%3A00" target="_blank" rel="nofollow" > What A Carry On</a > </h5> </td></tr><tr> <td width="90"> <h5 class="thin">12:50 am</h5> </td><td> <h5 class="thin"> <a href="https://www.ontvtonight.com/au/guide/listings/programme?cid=1692&sid=159923&dt=2021-11-24+13%3A50%3A00" target="_blank" rel="nofollow" > Bones</a > </h5> <h6>The Devil In The Details</h6> </td></tr><tr> <td width="90"> <h5 class="thin">10:50 pm</h5> </td><td> <h5 class="thin"> <a href="https://www.ontvtonight.com/au/guide/listings/programme?cid=1692&sid=372057&dt=2021-11-25+11%3A50%3A00" target="_blank" rel="nofollow" > Inspector Morse: The Remorseful Day</a > </h5> </td></tr></tbody> </table> </div></div></div></section> </div></body></html>
|
||||||
1
sites/ontvtonight.com/__data__/no_content.html
Normal file
1
sites/ontvtonight.com/__data__/no_content.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<!DOCTYPE html><html><head></head><body></body></html>
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
const { parser, url } = require('./ontvtonight.com.config.js')
|
const { parser, url } = require('./ontvtonight.com.config.js')
|
||||||
|
const fs = require('fs')
|
||||||
|
const path = require('path')
|
||||||
const dayjs = require('dayjs')
|
const dayjs = require('dayjs')
|
||||||
const utc = require('dayjs/plugin/utc')
|
const utc = require('dayjs/plugin/utc')
|
||||||
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||||
@@ -10,8 +12,6 @@ const channel = {
|
|||||||
site_id: 'au#1692/7two',
|
site_id: 'au#1692/7two',
|
||||||
xmltv_id: '7two.au'
|
xmltv_id: '7two.au'
|
||||||
}
|
}
|
||||||
const content =
|
|
||||||
'<!DOCTYPE html><html lang="en-AU" xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml"> <head> </head> <body> <div id="wrapper"> <section id="content"> <div class="container"> <div class="row"> <div class="span6"> <img src="https://otv-us-web.s3-us-west-2.amazonaws.com/logos/guide/media/ed49cf4f-1123-4bee-9c90-a6af375af310.png" border="0" align="right" alt="7TWO" width="140"/> <table class="table table-hover"> <tbody> <tr> <td width="90"> <h5 class="thin">12:10 am</h5> </td><td> <h5 class="thin"> <a href="https://www.ontvtonight.com/au/guide/listings/programme?cid=1692&sid=165632&dt=2021-11-24+13%3A10%3A00" target="_blank" rel="nofollow" > What A Carry On</a > </h5> </td></tr><tr> <td width="90"> <h5 class="thin">12:50 am</h5> </td><td> <h5 class="thin"> <a href="https://www.ontvtonight.com/au/guide/listings/programme?cid=1692&sid=159923&dt=2021-11-24+13%3A50%3A00" target="_blank" rel="nofollow" > Bones</a > </h5> <h6>The Devil In The Details</h6> </td></tr><tr> <td width="90"> <h5 class="thin">10:50 pm</h5> </td><td> <h5 class="thin"> <a href="https://www.ontvtonight.com/au/guide/listings/programme?cid=1692&sid=372057&dt=2021-11-25+11%3A50%3A00" target="_blank" rel="nofollow" > Inspector Morse: The Remorseful Day</a > </h5> </td></tr></tbody> </table> </div></div></div></section> </div></body></html>'
|
|
||||||
|
|
||||||
it('can generate valid url', () => {
|
it('can generate valid url', () => {
|
||||||
expect(url({ channel, date })).toBe(
|
expect(url({ channel, date })).toBe(
|
||||||
@@ -20,6 +20,7 @@ it('can generate valid url', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('can parse response', () => {
|
it('can parse response', () => {
|
||||||
|
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.html'), 'utf8')
|
||||||
const result = parser({ content, channel, date }).map(p => {
|
const result = parser({ content, channel, date }).map(p => {
|
||||||
p.start = p.start.toJSON()
|
p.start = p.start.toJSON()
|
||||||
p.stop = p.stop.toJSON()
|
p.stop = p.stop.toJSON()
|
||||||
@@ -50,7 +51,7 @@ it('can handle empty guide', () => {
|
|||||||
const result = parser({
|
const result = parser({
|
||||||
date,
|
date,
|
||||||
channel,
|
channel,
|
||||||
content: '<!DOCTYPE html><html><head></head><body></body></html>'
|
content: fs.readFileSync(path.resolve(__dirname, '__data__/no_content.html'), 'utf8')
|
||||||
})
|
})
|
||||||
expect(result).toMatchObject([])
|
expect(result).toMatchObject([])
|
||||||
})
|
})
|
||||||
|
|||||||
5
sites/pbsguam.org/__data__/content.html
Normal file
5
sites/pbsguam.org/__data__/content.html
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<!DOCTYPE html><html lang="en-US"> <head></head> <body> <script type='text/javascript' id='wcs-main-js-extra'>
|
||||||
|
/* <![CDATA[ */
|
||||||
|
var EventsSchedule_1 = {"feed":[{"title":"Xavier Riddle and the Secret Museum","id":5097,"thumbnail":false,"thumbnail_size":false,"multiday":false,"ending":"","duration":"30'","terms":[],"period":30,"excerpt":"","hash":"5d7710f569fec3fb1839bd7e5ad87038","visible":true,"timestamp":1637829000,"last":false,"start":"2021-11-25T08:30:00+00:00","end":"2021-11-25T09:00:00+00:00","future":true,"finished":false,"permalink":"https://pbsguam.org/class/xavier-riddle-and-the-secret-museum/?wcs_timestamp=1637829000","buttons":[],"meta":[]},{"title":"Austin City Limits","id":3916,"thumbnail":false,"thumbnail_size":false,"multiday":false,"ending":"","duration":"1h","terms":[],"period":60,"excerpt":"","hash":"1255a0a23db3b726b38a5384147ec677","visible":true,"timestamp":1638140400,"last":false,"start":"2021-11-28T23:00:00+00:00","end":"2021-11-29T00:00:00+00:00","future":true,"finished":false,"permalink":"https://pbsguam.org/class/austin-city-limits/?wcs_timestamp=1638140400","buttons":[],"meta":[]}]};
|
||||||
|
/* ]]> */
|
||||||
|
</script> </body></html>
|
||||||
1
sites/pbsguam.org/__data__/no_content.html
Normal file
1
sites/pbsguam.org/__data__/no_content.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<html> <head></head> <body></body></html>
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
const { parser, url } = require('./pbsguam.org.config.js')
|
const { parser, url } = require('./pbsguam.org.config.js')
|
||||||
|
const fs = require('fs')
|
||||||
|
const path = require('path')
|
||||||
const dayjs = require('dayjs')
|
const dayjs = require('dayjs')
|
||||||
const utc = require('dayjs/plugin/utc')
|
const utc = require('dayjs/plugin/utc')
|
||||||
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||||
@@ -16,11 +18,7 @@ it('can generate valid url', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('can parse response', () => {
|
it('can parse response', () => {
|
||||||
const content = `<!DOCTYPE html><html lang="en-US"> <head></head> <body> <script type='text/javascript' id='wcs-main-js-extra'>
|
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.html'), 'utf8')
|
||||||
/* <![CDATA[ */
|
|
||||||
var EventsSchedule_1 = {"feed":[{"title":"Xavier Riddle and the Secret Museum","id":5097,"thumbnail":false,"thumbnail_size":false,"multiday":false,"ending":"","duration":"30'","terms":[],"period":30,"excerpt":"","hash":"5d7710f569fec3fb1839bd7e5ad87038","visible":true,"timestamp":1637829000,"last":false,"start":"2021-11-25T08:30:00+00:00","end":"2021-11-25T09:00:00+00:00","future":true,"finished":false,"permalink":"https://pbsguam.org/class/xavier-riddle-and-the-secret-museum/?wcs_timestamp=1637829000","buttons":[],"meta":[]},{"title":"Austin City Limits","id":3916,"thumbnail":false,"thumbnail_size":false,"multiday":false,"ending":"","duration":"1h","terms":[],"period":60,"excerpt":"","hash":"1255a0a23db3b726b38a5384147ec677","visible":true,"timestamp":1638140400,"last":false,"start":"2021-11-28T23:00:00+00:00","end":"2021-11-29T00:00:00+00:00","future":true,"finished":false,"permalink":"https://pbsguam.org/class/austin-city-limits/?wcs_timestamp=1638140400","buttons":[],"meta":[]}]};
|
|
||||||
/* ]]> */
|
|
||||||
</script> </body></html>`
|
|
||||||
const result = parser({ date, content }).map(p => {
|
const result = parser({ date, content }).map(p => {
|
||||||
p.start = p.start.toJSON()
|
p.start = p.start.toJSON()
|
||||||
p.stop = p.stop.toJSON()
|
p.stop = p.stop.toJSON()
|
||||||
@@ -40,7 +38,7 @@ it('can handle empty guide', () => {
|
|||||||
const result = parser({
|
const result = parser({
|
||||||
date,
|
date,
|
||||||
channel,
|
channel,
|
||||||
content: '<html> <head></head> <body></body></html>'
|
content: fs.readFileSync(path.resolve(__dirname, '__data__/no_content.html'), 'utf8')
|
||||||
})
|
})
|
||||||
expect(result).toMatchObject([])
|
expect(result).toMatchObject([])
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user