Merge branch 'master' into add-tvprofil-com

This commit is contained in:
Shadix A 2021-08-31 16:33:32 +02:00 committed by GitHub
commit 6bcf59fbbb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 476 additions and 373 deletions

View file

@ -18,7 +18,6 @@ jobs:
hd-plus.de, hd-plus.de,
astro.com.my, astro.com.my,
comteco.com.bo, comteco.com.bo,
albepg.com,
mi.tv, mi.tv,
meo.pt, meo.pt,
tvgid.ua, tvgid.ua,
@ -36,6 +35,7 @@ jobs:
tvtv.us, tvtv.us,
tv.lv, tv.lv,
vidio.com, vidio.com,
tvguide.com,
tvprofil.com tvprofil.com
] ]
steps: steps:

View file

@ -858,6 +858,7 @@ beIN Sports 11,beINSports11.qa
beIN Sports 12,beINSports12.qa beIN Sports 12,beINSports12.qa
beIN Sports 13,beINSports13.qa beIN Sports 13,beINSports13.qa
beIN Sports 2,beINSports2.qa beIN Sports 2,beINSports2.qa
beIN Sports 2 Asia,beINSports2Asia.qa
beIN Sports 3,beINSports3.qa beIN Sports 3,beINSports3.qa
beIN Sports Canada,beINSportsCanada.qa beIN Sports Canada,beINSportsCanada.qa
beIN Sports en Español,beINSportsenEspanol.qa beIN Sports en Español,beINSportsenEspanol.qa

1 Channel Name EPG Code (tvg-id)
858 beIN Sports 12 beINSports12.qa
859 beIN Sports 13 beINSports13.qa
860 beIN Sports 2 beINSports2.qa
861 beIN Sports 2 Asia beINSports2Asia.qa
862 beIN Sports 3 beINSports3.qa
863 beIN Sports Canada beINSportsCanada.qa
864 beIN Sports en Español beINSportsenEspanol.qa

View file

@ -1,124 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<site site="albepg.com">
<channels>
<channel site_id="21 Junior" xmltv_id="21Junior.rs">21 Junior</channel>
<channel site_id="21 Popullore" xmltv_id="21Popullore.rs">21 Popullore</channel>
<channel site_id="24 Kitchen" xmltv_id="24KitchenSrbija.us">24 Kitchen Srbija</channel>
<channel site_id="3 Plus" xmltv_id="3Plus.al">3 Plus</channel>
<channel site_id="ABC News" xmltv_id="ABCNews.al">ABC News</channel>
<channel site_id="ALBUK TV" xmltv_id="AlbUKTV.uk">AlbUK TV</channel>
<channel site_id="Alsat-M" xmltv_id="Alsat.mk">Alsat</channel>
<channel site_id="Animal Planet" xmltv_id="AnimalPlanetEurope.us">Animal Planet Europe</channel>
<channel site_id="Arena Sport 1" xmltv_id="ArenaSport1.rs">Arena Sport 1</channel>
<channel site_id="Arena Sport 2" xmltv_id="ArenaSport2.rs">Arena Sport 2</channel>
<channel site_id="Arena Sport 3" xmltv_id="ArenaSport3.rs">Arena Sport 3</channel>
<channel site_id="Arena Sport 4" xmltv_id="ArenaSport4.rs">Arena Sport 4</channel>
<channel site_id="Arta HD" xmltv_id="Arta.rs">Arta</channel>
<channel site_id="BBF" xmltv_id="BBFMusicTV.al">BBF Music TV</channel>
<channel site_id="Baby TV" xmltv_id="BabyTVEurope.uk">BabyTV Europe</channel>
<channel site_id="Balkanika" xmltv_id="BalkanikaTV.bg">Balkanika TV</channel>
<channel site_id="Bang Bang" xmltv_id="BangBang.al">Bang Bang</channel>
<channel site_id="Boomerang" xmltv_id="BoomerangEMEA.us">Boomerang EMEA</channel>
<channel site_id="Click TV" xmltv_id="ClickTV.al">Click TV</channel>
<channel site_id="Discovery Channel" xmltv_id="DiscoveryChannelBulgaria.us">Discovery Channel Bulgaria</channel>
<channel site_id="Elrodi TV" xmltv_id="ElrodiTV.al">Elrodi TV</channel>
<channel site_id="EuroNews Albania" xmltv_id="EuronewsAlbania.fr">Euronews Albania</channel>
<channel site_id="EuroSport" xmltv_id="Eurosport1.fr">Eurosport 1</channel>
<channel site_id="EXPLORER Histori" xmltv_id="ExplorerHistori.al">Explorer Histori</channel>
<channel site_id="EXPLORER Natyra" xmltv_id="ExplorerNatyra.al">Explorer Natyra</channel>
<channel site_id="EXPLORER Shkence" xmltv_id="ExplorerShkence.al">Explorer Shkencë</channel>
<channel site_id="Family HD" xmltv_id="FamilyHD.al">Family HD</channel>
<channel site_id="Fashion TV" xmltv_id="FashionTVEurope.fr">FashionTV Europe</channel>
<channel site_id="Film Aksion" xmltv_id="FilmAksion.al">Film Aksion</channel>
<channel site_id="Film Drame" xmltv_id="FilmDrame.al">Film Drame</channel>
<channel site_id="Film Dy HD" xmltv_id="FilmDyHD.al">Film Dy HD</channel>
<channel site_id="Film Hits" xmltv_id="FilmHits.al">Film Hits</channel>
<channel site_id="Film Hits+1" xmltv_id="FilmHitsPlus1.al">Film Hits +1</channel>
<channel site_id="Film Komedi" xmltv_id="FilmKomedi.al">Film Komedi</channel>
<channel site_id="Film Nje HD" xmltv_id="FilmNjeHD.al">Film Një HD</channel>
<channel site_id="Film Thriller" xmltv_id="FilmThriller.al">Film Thriller</channel>
<channel site_id="Folk Plus" xmltv_id="FolkPlus.al">Folk+</channel>
<channel site_id="FOX Life" xmltv_id="FoxLifeRegional.us">Fox Life Regional</channel>
<channel site_id="FOX" xmltv_id="FoxSrbija.us">Fox Srbija</channel>
<channel site_id="INTV" xmltv_id="InTV.al">In TV</channel>
<channel site_id="ID Xtra HD" xmltv_id="InvestigationDiscoveryEurope.us">Investigation Discovery Europe</channel>
<channel site_id="Junior" xmltv_id="JuniorTV.al">Junior TV</channel>
<channel site_id="Kanal 10" xmltv_id="Kanal10.rs">Kanal 10</channel>
<channel site_id="KanalD Drama" xmltv_id="KanalDDrama.tr">Kanal D Drama</channel>
<channel site_id="Kanali 7" xmltv_id="Kanali7.al">Kanali 7</channel>
<channel site_id="Klan Kosova" xmltv_id="KlanKosova.al">Klan Kosova</channel>
<channel site_id="Klan Macedonia" xmltv_id="KlanMacedonia.al">Klan Macedonia</channel>
<channel site_id="Klan Plus" xmltv_id="KlanPlus.al">Klan Plus</channel>
<channel site_id="KTV" xmltv_id="Kohavision.rs">Kohavision</channel>
<channel site_id="Living HD" xmltv_id="LivingHD.al">Living HD</channel>
<channel site_id="MFM" xmltv_id="MFM.al">MFM</channel>
<channel site_id="MTV Live HD" xmltv_id="MTVLiveHD.us">MTV Live HD</channel>
<channel site_id="Muse" xmltv_id="Muse.al">Muse</channel>
<channel site_id="My Music" xmltv_id="MyMusic.al">My Music</channel>
<channel site_id="National Geographic" xmltv_id="NationalGeographicChannelHDEurope.us">National Geographic Channel HD Europe</channel>
<channel site_id="Neser TV" xmltv_id="NeserTV.al">Nesër TV</channel>
<channel site_id="News 24" xmltv_id="News24.al">News 24</channel>
<channel site_id="On-TV" xmltv_id="OnTV.al">On-TV</channel>
<channel site_id="Ora News" xmltv_id="OraNews.al">Ora News</channel>
<channel site_id="Peace TV" xmltv_id="PeaceTVEnglish.ae">Peace TV English</channel>
<channel site_id="RTSH1 HD" xmltv_id="RTSH1.al">RTSH 1</channel>
<channel site_id="RTSH2 HD" xmltv_id="RTSH2.al">RTSH 2</channel>
<channel site_id="RTSH3 HD" xmltv_id="RTSH3.al">RTSH 3</channel>
<channel site_id="RTSH Agro" xmltv_id="RTSHAgro.al">RTSH Agro</channel>
<channel site_id="RTSH Femije" xmltv_id="RTSHFemije.al">RTSH Femije</channel>
<channel site_id="RTSH Film" xmltv_id="RTSHFilm.al">RTSH Film</channel>
<channel site_id="RTSH Korca" xmltv_id="RTSHKorca.al">RTSH Korca</channel>
<channel site_id="RTSH Muzike" xmltv_id="RTSHMuzike.al">RTSH Muzikë</channel>
<channel site_id="RTSH Plus" xmltv_id="RTSHPlus.al">RTSH Plus</channel>
<channel site_id="RTSH Shkolle" xmltv_id="RTSHShkolle.al">RTSH Shkolle</channel>
<channel site_id="RTSH Shqip" xmltv_id="RTSHShqip.al">RTSH Shqip</channel>
<channel site_id="RTSH Sport" xmltv_id="RTSHSport.al">RTSH Sport</channel>
<channel site_id="RTV 21" xmltv_id="RTV21.rs">RTV21</channel>
<channel site_id="STV Folk" xmltv_id="STVFolk.al">STV Folk</channel>
<channel site_id="Stinet" xmltv_id="Stinet.al">Stinët</channel>
<channel site_id="SuperSonic TV" xmltv_id="SuperSonicTV.al">Super Sonic TV</channel>
<channel site_id="SuperSport 1" xmltv_id="SuperSport1.al">SuperSport 1</channel>
<channel site_id="SuperSport 2" xmltv_id="SuperSport2.al">SuperSport 2</channel>
<channel site_id="SuperSport 3" xmltv_id="SuperSport3.al">SuperSport 3</channel>
<channel site_id="SuperSport 4" xmltv_id="SuperSport4.al">SuperSport 4</channel>
<channel site_id="SuperSport 5" xmltv_id="SuperSport5.al">SuperSport 5</channel>
<channel site_id="SuperSport 6" xmltv_id="SuperSport6.al">SuperSport 6</channel>
<channel site_id="SS Kosova 1" xmltv_id="SuperSportKosova1.al">SuperSport Kosova 1</channel>
<channel site_id="SS Kosova 2" xmltv_id="SuperSportKosova2.al">SuperSport Kosova 2</channel>
<channel site_id="SS Kosova 3" xmltv_id="SuperSportKosova3.al">SuperSport Kosova 3</channel>
<channel site_id="T 7" xmltv_id="T7.rs">T7</channel>
<channel site_id="RTV 21 MK" xmltv_id="TV21Macedonia.rs">TV 21 Macedonia</channel>
<channel site_id="Klan TV" xmltv_id="TVKlan.al">TV Klan</channel>
<channel site_id="Koha TV" xmltv_id="TVKoha.al">TV Koha</channel>
<channel site_id="Shenja TV" xmltv_id="TVShenja.mk">TV Shenja</channel>
<channel site_id="TV Tetova" xmltv_id="TVTetova.mk">TV Tetova</channel>
<channel site_id="RTM2" xmltv_id="TVM2.mk">TVM2</channel>
<channel site_id="TeleSport" xmltv_id="Telesport.al">Telesport</channel>
<channel site_id="Tip TV" xmltv_id="TipTV.al">Tip TV</channel>
<channel site_id="Top Channel" xmltv_id="TopChannel.al">Top Channel</channel>
<channel site_id="Top News" xmltv_id="TopNews.al">Top News</channel>
<channel site_id="Tribuna Channel" xmltv_id="TribunaChannel.xk">Tribuna Channel</channel>
<channel site_id="Tring Action" xmltv_id="TringAction.al">Tring Action</channel>
<channel site_id="Tring Comedy" xmltv_id="TringComedy.al">Tring Comedy</channel>
<channel site_id="Tring Family" xmltv_id="TringFamily.al">Tring Family</channel>
<channel site_id="Tring Fantasy" xmltv_id="TringFantasy.al">Tring Fantasy</channel>
<channel site_id="Tring History" xmltv_id="TringHistory.al">Tring History</channel>
<channel site_id="Tring International" xmltv_id="TringInternational.al">Tring International</channel>
<channel site_id="Jolly HD" xmltv_id="TringJolly.al">Tring Jolly</channel>
<channel site_id="Tring Kids" xmltv_id="TringKids.al">Tring Kids</channel>
<channel site_id="Tring Life" xmltv_id="TringLife.al">Tring Life</channel>
<channel site_id="Tring Planet" xmltv_id="TringPlanet.al">Tring Planet</channel>
<channel site_id="Tring Shqip" xmltv_id="TringShqip.al">Tring Shqip</channel>
<channel site_id="Smile" xmltv_id="TringSmile.al">Tring Smile</channel>
<channel site_id="Tring Sport 1 HD" xmltv_id="TringSport1.al">Tring Sport 1</channel>
<channel site_id="Tring Sport 2 HD" xmltv_id="TringSport2.al">Tring Sport 2</channel>
<channel site_id="Tring Sport 3 HD" xmltv_id="TringSport3.al">Tring Sport 3</channel>
<channel site_id="Tring Sport 4 HD" xmltv_id="TringSport4.al">Tring Sport 4</channel>
<channel site_id="Tring Sport News HD" xmltv_id="TringSportNews.al">Tring Sport News</channel>
<channel site_id="Tring Super" xmltv_id="TringSuper.al">Tring Super</channel>
<channel site_id="Tring Tring" xmltv_id="TringTring.al">Tring Tring</channel>
<channel site_id="Tring World" xmltv_id="TringWorld.al">Tring World</channel>
<channel site_id="Vizion Plus" xmltv_id="VizionPlus.al">Vizion Plus</channel>
<channel site_id="Cufo TV" xmltv_id="Cufo.al">Çufo</channel>
</channels>
</site>

View file

@ -1,51 +0,0 @@
const epgParser = require('epg-parser')
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: 'sq',
site: 'albepg.com',
channels: 'albepg.com.channels.xml',
output: '.gh-pages/guides/albepg.com.guide.xml',
request: {
timeout: 15000,
headers: {
Referer: 'http://albepg.com/epg.html'
}
},
url: function () {
return `http://albepg.com/epg/guide.xml`
},
logo: function ({ channel }) {
return `http://albepg.com/tvlogi/${channel.site_id}.png`
},
parser: function ({ content, channel, date }) {
const results = epgParser.parse(content)
let programs = []
results.programs
.filter(item => item.channel === channel.site_id)
.forEach(item => {
if (item.title.length && item.start && item.stop) {
const description = item.desc.length ? item.desc[0].value : null
const category = item.category.length ? item.category[0].value : null
const start = dayjs.utc(item.start, 'YYYYMMDDHHmmss Z')
const stop = dayjs.utc(item.stop, 'YYYYMMDDHHmmss Z')
if (start.diff(date.format('YYYY-MM-DD'), 'd') === 0) {
programs.push({
title: item.title[0].value,
description,
category,
start: start.toString(),
stop: stop.toString()
})
}
}
})
return programs
}
}

View file

@ -2,11 +2,14 @@ const jsdom = require('jsdom')
const { JSDOM } = jsdom const { JSDOM } = jsdom
const dayjs = require('dayjs') const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc') const utc = require('dayjs/plugin/utc')
const timezone = require('dayjs/plugin/timezone')
const customParseFormat = require('dayjs/plugin/customParseFormat') const customParseFormat = require('dayjs/plugin/customParseFormat')
dayjs.extend(utc) dayjs.extend(utc)
dayjs.extend(timezone)
dayjs.extend(customParseFormat) dayjs.extend(customParseFormat)
let PM = false
module.exports = { module.exports = {
lang: 'ca', lang: 'ca',
site: 'andorradifusio.ad', site: 'andorradifusio.ad',
@ -16,36 +19,59 @@ module.exports = {
return `https://www.andorradifusio.ad/programacio/${channel.site_id}` return `https://www.andorradifusio.ad/programacio/${channel.site_id}`
}, },
parser({ content, date }) { parser({ content, date }) {
const day = date.day() - 1
const programs = [] const programs = []
const dom = new JSDOM(content) const items = parseItems(content, date)
const cols = dom.window.document.querySelectorAll('.programacio-dia') items.forEach(item => {
const colNum = day < 0 ? 6 : day const title = parseTitle(item)
const times = cols[colNum].querySelectorAll(`h4`) let start = parseStart(item, date)
const titles = cols[colNum].querySelectorAll(`p`) if (start.hour() > 11) PM = true
if (start.hour() < 12 && PM) start = start.add(1, 'd')
times.forEach((time, i) => { const stop = parseStop(item, date)
const title = titles[i] ? titles[i].textContent : null if (programs.length) {
if (!time || !title) return false
const start = dayjs
.utc(time.textContent, 'HH:mm')
.set('D', date.get('D'))
.set('M', date.get('M'))
.set('y', date.get('y'))
if (!start.isValid()) return false
if (programs.length && !programs[programs.length - 1].stop) {
programs[programs.length - 1].stop = start programs[programs.length - 1].stop = start
} }
programs.push({ programs.push({
title, title,
start start,
stop
}) })
}) })
return programs return programs
} }
} }
function parseStop(item, date) {
return date.tz('Europe/Madrid').endOf('d').add(6, 'h')
}
function parseStart(item, date) {
let time = (item.time || { textContent: '' }).textContent
time = `${date.format('MM/DD/YYYY')} ${time}`
return dayjs.tz(time, 'MM/DD/YYYY HH:mm', 'Europe/Madrid')
}
function parseTitle(item) {
return (item.title || { textContent: '' }).textContent
}
function parseItems(content, date) {
const items = []
const dom = new JSDOM(content)
const day = date.day() - 1
const colNum = day < 0 ? 6 : day
const cols = dom.window.document.querySelectorAll('.programacio-dia')
const col = cols[colNum]
const timeRows = col.querySelectorAll(`h4`)
const titleRows = col.querySelectorAll(`p`)
timeRows.forEach((time, i) => {
items.push({
time,
title: titleRows[i]
})
})
return items
}

View file

@ -2,9 +2,11 @@ const jsdom = require('jsdom')
const { JSDOM } = jsdom const { JSDOM } = jsdom
const dayjs = require('dayjs') const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc') const utc = require('dayjs/plugin/utc')
const timezone = require('dayjs/plugin/timezone')
const customParseFormat = require('dayjs/plugin/customParseFormat') const customParseFormat = require('dayjs/plugin/customParseFormat')
dayjs.extend(utc) dayjs.extend(utc)
dayjs.extend(timezone)
dayjs.extend(customParseFormat) dayjs.extend(customParseFormat)
module.exports = { module.exports = {
@ -25,38 +27,43 @@ module.exports = {
}, },
parser: function ({ content, date }) { parser: function ({ content, date }) {
const programs = [] const programs = []
const dom = new JSDOM(content) const items = parseItems(content)
const items = dom.window.document.querySelectorAll('#datosasociados > div > .list-group-item')
items.forEach(item => { items.forEach(item => {
const time = ( const title = parseTitle(item)
item.querySelector('div > div.col-xs-11 > p > span') || { textContent: '' } let start = parseStart(item, date)
).textContent const stop = parseStop(item, date)
.toString() if (programs.length) {
.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[programs.length - 1].stop = start
} }
programs.push({ programs.push({ title, start, stop })
title,
start: start.toString()
})
}
}) })
return programs return programs
} }
} }
function parseStop(item, date) {
return date.tz('America/La_Paz').endOf('d')
}
function parseStart(item, date) {
let time = (
item.querySelector('div > div.col-xs-11 > p > span') || { textContent: '' }
).textContent.trim()
time = `${date.format('MM/DD/YYYY')} ${time}`
return dayjs.tz(time, 'MM/DD/YYYY HH:mm:ss', 'America/La_Paz')
}
function parseTitle(item) {
return (
item.querySelector('div > div.col-xs-11 > p > strong') || { textContent: '' }
).textContent.trim()
}
function parseItems(content) {
const dom = new JSDOM(content)
return dom.window.document.querySelectorAll('#datosasociados > div > .list-group-item')
}

View file

@ -2,12 +2,12 @@ const jsdom = require('jsdom')
const { JSDOM } = jsdom const { JSDOM } = jsdom
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 timezone = require('dayjs/plugin/timezone') const timezone = require('dayjs/plugin/timezone')
const customParseFormat = require('dayjs/plugin/customParseFormat')
dayjs.extend(utc) dayjs.extend(utc)
dayjs.extend(customParseFormat)
dayjs.extend(timezone) dayjs.extend(timezone)
dayjs.extend(customParseFormat)
module.exports = { module.exports = {
lang: 'de', lang: 'de',
@ -26,29 +26,42 @@ module.exports = {
return img ? img.src : null return img ? img.src : null
}, },
parser({ content }) { parser({ content, date }) {
const dom = new JSDOM(content) const programs = []
const items = dom.window.document.querySelectorAll('table > tbody > tr') const items = parseItems(content)
let programs = []
items.forEach(item => { items.forEach(item => {
const title = (item.querySelector('td:nth-child(1) > a') || { textContent: '' }).textContent const title = parseTitle(item)
const fullDate = (item.querySelector('td:nth-child(2)') || { textContent: '' }).textContent let start = parseStart(item, date)
if (title && fullDate) { const stop = parseStop(item, date)
const time = fullDate.split(' ').pop() if (programs.length) {
const local = dayjs.utc(time, 'HH:mm').toString()
const start = dayjs.tz(local.toString(), 'Europe/Berlin').toString()
if (programs.length && !programs[programs.length - 1].stop) {
programs[programs.length - 1].stop = start programs[programs.length - 1].stop = start
} }
programs.push({ programs.push({ title, start, stop })
title,
start
})
}
}) })
return programs return programs
} }
} }
function parseStop(item, date) {
return date.endOf('d')
}
function parseStart(item, date) {
let time = (item.querySelector('td:nth-child(2)') || { textContent: '' }).textContent
time = time.split(' ').pop()
time = `${date.format('MM/DD/YYYY')} ${time}`
return dayjs.tz(time, 'MM/DD/YYYY HH:mm', 'Europe/Berlin')
}
function parseTitle(item) {
return (item.querySelector('td:nth-child(1) > a') || { textContent: '' }).textContent
}
function parseItems(content) {
const dom = new JSDOM(content)
return dom.window.document.querySelectorAll('table > tbody > tr')
}

View file

@ -3,13 +3,14 @@ const iconv = require('iconv-lite')
const { JSDOM } = jsdom const { JSDOM } = jsdom
const dayjs = require('dayjs') const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc') const utc = require('dayjs/plugin/utc')
var customParseFormat = require('dayjs/plugin/customParseFormat') const timezone = require('dayjs/plugin/timezone')
var timezone = require('dayjs/plugin/timezone') const customParseFormat = require('dayjs/plugin/customParseFormat')
dayjs.extend(utc) dayjs.extend(utc)
dayjs.extend(customParseFormat)
dayjs.extend(timezone) dayjs.extend(timezone)
dayjs.extend(customParseFormat)
let PM = false
module.exports = { module.exports = {
lang: 'cs', lang: 'cs',
site: 'm.tv.sms.cz', site: 'm.tv.sms.cz',
@ -28,40 +29,53 @@ module.exports = {
}, },
parser: function ({ buffer, date }) { parser: function ({ buffer, date }) {
const programs = [] const programs = []
const string = iconv.decode(buffer, 'win1250') const items = parseItems(buffer)
const dom = new JSDOM(string)
const items = dom.window.document.querySelectorAll('#obsah > div > div.porady > div.porad')
items.forEach((item, i) => { items.forEach((item, i) => {
const time = (item.querySelector('div > span') || { textContent: '' }).textContent const title = parseTitle(item)
.toString() const description = parseDescription(item)
.trim() let start = parseStart(item, date)
const title = (item.querySelector('a > div') || { textContent: '' }).textContent if (start.hour() > 11) PM = true
.toString() if (start.hour() < 12 && PM) start = start.add(1, 'd')
.trim() const stop = parseStop(item, date)
const description = (item.querySelector('a > div.detail') || { textContent: '' }).textContent if (programs.length) {
.toString()
.trim()
if (time && title) {
let local = dayjs.utc(time, 'HH.mm').date(date.date()).month(date.month()).year(date.year())
if (local.hour() <= 6 && i > items.length / 2) {
local = local.date(local.date() + 1)
}
const start = dayjs.tz(local.toString(), 'Europe/Prague').toString()
if (programs.length && !programs[programs.length - 1].stop) {
programs[programs.length - 1].stop = start programs[programs.length - 1].stop = start
} }
programs.push({ programs.push({
title, title,
description, description,
start start,
stop
}) })
}
}) })
return programs return programs
} }
} }
function parseStop(item, date) {
return date.tz('Europe/Prague').endOf('d').add(6, 'h')
}
function parseStart(item, date) {
let time = (item.querySelector('div > span') || { textContent: '' }).textContent.trim()
time = `${date.format('MM/DD/YYYY')} ${time}`
return dayjs.tz(time, 'MM/DD/YYYY HH.mm', 'Europe/Prague')
}
function parseDescription(item) {
return (item.querySelector('a > div.detail') || { textContent: '' }).textContent.trim()
}
function parseTitle(item) {
return (item.querySelector('a > div') || { textContent: '' }).textContent.trim()
}
function parseItems(buffer) {
const string = iconv.decode(buffer, 'win1250')
const dom = new JSDOM(string)
return dom.window.document.querySelectorAll('#obsah > div > div.porady > div.porad')
}

View file

@ -114,5 +114,9 @@
<channel site_id="I24I" xmltv_id="i24NewsEnglish.il">i24 News English</channel> <channel site_id="I24I" xmltv_id="i24NewsEnglish.il">i24 News English</channel>
<channel site_id="I24F" xmltv_id="i24NewsFrancais.il">i24 News Français</channel> <channel site_id="I24F" xmltv_id="i24NewsFrancais.il">i24 News Français</channel>
<channel site_id="1RUSS" xmltv_id="Pervyykanal.ru">Первый канал</channel> <channel site_id="1RUSS" xmltv_id="Pervyykanal.ru">Первый канал</channel>
<channel site_id="TVCTOPH" xmltv_id="TVCineTop.pt">TVCine Top</channel>
<channel site_id="TVCEDIH" xmltv_id="TVCineEdition.ru">TVCine Edition</channel>
<channel site_id="TVCEMOH" xmltv_id="TVCineEmotion.ru">TVCine Emotion</channel>
<channel site_id="TVCACTH" xmltv_id="TVCineAction.ru">TVCine Action</channel>
</channels> </channels>
</site> </site>

View file

@ -2,11 +2,14 @@ const jsdom = require('jsdom')
const { JSDOM } = jsdom const { JSDOM } = jsdom
const dayjs = require('dayjs') const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc') const utc = require('dayjs/plugin/utc')
const timezone = require('dayjs/plugin/timezone')
const customParseFormat = require('dayjs/plugin/customParseFormat') const customParseFormat = require('dayjs/plugin/customParseFormat')
dayjs.extend(utc) dayjs.extend(utc)
dayjs.extend(timezone)
dayjs.extend(customParseFormat) dayjs.extend(customParseFormat)
let PM = false
module.exports = { module.exports = {
lang: 'pt', lang: 'pt',
site: 'mi.tv', site: 'mi.tv',
@ -23,32 +26,48 @@ module.exports = {
}, },
parser({ content, date }) { parser({ content, date }) {
const programs = [] const programs = []
const dom = new JSDOM(content) const items = parseItems(content)
const items = dom.window.document.querySelectorAll('#listings > ul > li')
items.forEach(item => { items.forEach(item => {
const title = (item.querySelector('a > div.content > h2') || { textContent: '' }).textContent const title = parseTitle(item)
const time = (item.querySelector('a > div.content > span.time') || { textContent: '' }) let start = parseStart(item, date)
.textContent if (!start) return
if (start.hour() > 11) PM = true
if (title && time) { if (start.hour() < 12 && PM) start = start.add(1, 'd')
const start = dayjs const stop = parseStop(item, start)
.utc(time, 'HH:mm') if (programs.length) {
.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[programs.length - 1].stop = start
} }
programs.push({ programs.push({
title, title,
start start,
stop
}) })
}
}) })
return programs return programs
} }
} }
function parseStop(item, date) {
return date.endOf('d').add(6, 'h')
}
function parseStart(item, date) {
let time = (item.querySelector('a > div.content > span.time') || { textContent: '' }).textContent
if (!time) return null
time = `${date.format('MM/DD/YYYY')} ${time}`
return dayjs.tz(time, 'MM/DD/YYYY HH:mm', 'America/Sao_Paulo')
}
function parseTitle(item) {
return (item.querySelector('a > div.content > h2') || { textContent: '' }).textContent
}
function parseItems(content) {
const dom = new JSDOM(content)
return dom.window.document.querySelectorAll('#listings > ul > li')
}

View file

@ -2,11 +2,14 @@ const jsdom = require('jsdom')
const { JSDOM } = jsdom const { JSDOM } = jsdom
const dayjs = require('dayjs') const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc') const utc = require('dayjs/plugin/utc')
const timezone = require('dayjs/plugin/timezone')
const customParseFormat = require('dayjs/plugin/customParseFormat') const customParseFormat = require('dayjs/plugin/customParseFormat')
dayjs.extend(utc) dayjs.extend(utc)
dayjs.extend(timezone)
dayjs.extend(customParseFormat) dayjs.extend(customParseFormat)
let PM = false
module.exports = { module.exports = {
lang: 'pl', lang: 'pl',
site: 'programtv.onet.pl', site: 'programtv.onet.pl',
@ -24,24 +27,16 @@ module.exports = {
}, },
parser: function ({ content, date }) { parser: function ({ content, date }) {
const programs = [] const programs = []
const dom = new JSDOM(content) const items = parseItems(content)
const items = dom.window.document.querySelectorAll(
'#channelTV > section > div.emissions > ul > li'
)
items.forEach(item => { items.forEach(item => {
const title = (item.querySelector('.titles > a') || { textContent: '' }).textContent const title = parseTitle(item)
const description = (item.querySelector('.titles > p') || { textContent: '' }).textContent const description = parseDescription(item)
const category = (item.querySelector('.titles > .type') || { textContent: '' }).textContent const category = parseCategory(item)
const hour = (item.querySelector('.hours > .hour') || { textContent: '' }).textContent let start = parseStart(item, date)
if (start.hour() > 11) PM = true
const start = dayjs if (start.hour() < 12 && PM) start = start.add(1, 'd')
.utc(hour, 'H:mm') const stop = parseStop(item, date)
.set('D', date.get('D')) if (programs.length) {
.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[programs.length - 1].stop = start
} }
@ -49,10 +44,40 @@ module.exports = {
title, title,
description, description,
category, category,
start start,
stop
}) })
}) })
return programs return programs
} }
} }
function parseStop(item, date) {
return date.add(1, 'd').hour(3).startOf('h')
}
function parseStart(item, date) {
let time = (item.querySelector('.hours > .hour') || { textContent: '' }).textContent
time = `${date.format('MM/DD/YYYY')} ${time}`
return dayjs.tz(time, 'MM/DD/YYYY HH:mm', 'Europe/Warsaw')
}
function parseCategory(item) {
return (item.querySelector('.titles > .type') || { textContent: '' }).textContent
}
function parseDescription(item) {
return (item.querySelector('.titles > p') || { textContent: '' }).textContent
}
function parseTitle(item) {
return (item.querySelector('.titles > a') || { textContent: '' }).textContent
}
function parseItems(content) {
const dom = new JSDOM(content)
return dom.window.document.querySelectorAll('#channelTV > section > div.emissions > ul > li')
}

View file

@ -3,11 +3,14 @@ const iconv = require('iconv-lite')
const { JSDOM } = jsdom const { JSDOM } = jsdom
const dayjs = require('dayjs') const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc') const utc = require('dayjs/plugin/utc')
const timezone = require('dayjs/plugin/timezone')
const customParseFormat = require('dayjs/plugin/customParseFormat') const customParseFormat = require('dayjs/plugin/customParseFormat')
dayjs.extend(utc) dayjs.extend(utc)
dayjs.extend(timezone)
dayjs.extend(customParseFormat) dayjs.extend(customParseFormat)
let PM = false
module.exports = { module.exports = {
lang: 'uk', lang: 'uk',
site: 'tvgid.ua', site: 'tvgid.ua',
@ -18,36 +21,50 @@ module.exports = {
}, },
parser: function ({ buffer, date }) { parser: function ({ buffer, date }) {
const programs = [] const programs = []
const string = iconv.decode(buffer, 'win1251') const items = parseItems(buffer)
const dom = new JSDOM(string)
const items = dom.window.document.querySelectorAll(
'#container > tbody > tr:nth-child(2) > td > table > tbody > tr > td > table:nth-child(2) > tbody > tr'
)
items.forEach(item => { items.forEach(item => {
const time = (item.querySelector('td > table > tbody > tr > td.time') || { textContent: '' }) const title = parseTitle(item)
.textContent let start = parseStart(item, date)
const title = ( if (!start) return
item.querySelector('td > table > tbody > tr > td.item > a') || if (start.hour() > 11) PM = true
item.querySelector('td > table > tbody > tr > td.item') || { textContent: '' } if (start.hour() < 12 && PM) start = start.add(1, 'd')
).textContent const stop = parseStop(item, start)
if (programs.length) {
const start = dayjs
.utc(time, 'HH:mm')
.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[programs.length - 1].stop = start
} }
programs.push({ programs.push({ title, start, stop })
title,
start
})
}) })
return programs return programs
} }
} }
function parseStop(item, date) {
return date.hour(7)
}
function parseStart(item, date) {
let time = (item.querySelector('td > table > tbody > tr > td.time') || { textContent: '' })
.textContent
if (!time) return null
time = `${date.format('MM/DD/YYYY')} ${time}`
return dayjs.tz(time, 'MM/DD/YYYY HH:mm', 'Europe/Kiev')
}
function parseTitle(item) {
return (
item.querySelector('td > table > tbody > tr > td.item > a') ||
item.querySelector('td > table > tbody > tr > td.item') || { textContent: '' }
).textContent
}
function parseItems(buffer) {
const string = iconv.decode(buffer, 'win1251')
const dom = new JSDOM(string)
return dom.window.document.querySelectorAll(
'#container > tbody > tr:nth-child(2) > td > table > tbody > tr > td > table:nth-child(2) > tbody > tr:not(:first-child)'
)
}

93
sites/tvguide.com.channels.xml Executable file
View file

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<site site="tvguide.com">
<channels>
<channel site_id="9100001138#9200004889" xmltv_id="AEEast.us">A&amp;E East</channel>
<channel site_id="9100001138#9233011874" xmltv_id="ABCEast.us">ABC East</channel>
<channel site_id="9100001138#9233011832" xmltv_id="AMCEast.us">AMC East</channel>
<channel site_id="9100001138#9200018479" xmltv_id="AnimalPlanetEast.us">Animal Planet East</channel>
<channel site_id="9100001138#9200014701" xmltv_id="BBCAmericaEast.uk">BBC America East</channel>
<channel site_id="9100001138#9233005931" xmltv_id="BETEast.us">BET East</channel>
<channel site_id="9100001138#9200002886" xmltv_id="BravoEast.us">Bravo East</channel>
<channel site_id="9100001138#9200004848" xmltv_id="CartoonNetworkEast.us">Cartoon Network East</channel>
<channel site_id="9100001138#9200018514" xmltv_id="CBSEast.us">CBS East</channel>
<channel site_id="9100001138#9233009829" xmltv_id="CinemaxEast.us">Cinemax East</channel>
<channel site_id="9100001138#9200012085" xmltv_id="CMTEast.us">CMT East</channel>
<channel site_id="9100001138#9200009413" xmltv_id="CNBCUS.us">CNBC US</channel>
<channel site_id="9100001138#9233013812" xmltv_id="CNNUSA.us">CNN USA</channel>
<channel site_id="9100001138#9200000657" xmltv_id="ComedyCentralEast.us">Comedy Central East</channel>
<channel site_id="9100001138#9233004102" xmltv_id="DiscoveryChannelEast.us">Discovery Channel East</channel>
<channel site_id="9100001138#9233013857" xmltv_id="DiscoveryLifeChannel.us">Discovery Life Channel</channel>
<channel site_id="9100001138#9200018475" xmltv_id="DisneyChannelEast.us">Disney Channel East</channel>
<channel site_id="9100001138#9200004852" xmltv_id="DisneyXDEast.us">Disney XD East</channel>
<channel site_id="9100001138#9200012415" xmltv_id="DIYNetworkUSA.us">DIY Network USA</channel>
<channel site_id="9100001138#9200012343" xmltv_id="EEast.us">E! East</channel>
<channel site_id="9100001138#9200006937" xmltv_id="ESPN.us">ESPN</channel>
<channel site_id="9100001138#9200012351" xmltv_id="ESPN2US.us">ESPN 2 US</channel>
<channel site_id="9100001138#9233011637" xmltv_id="ESPNClassicUSA.us">ESPN Classic USA</channel>
<channel site_id="9100001138#9233011350" xmltv_id="ESPNU.us">ESPNU</channel>
<channel site_id="9100001138#9233000217" xmltv_id="FlixEast.us">Flix East</channel>
<channel site_id="9100001138#9233009448" xmltv_id="FoodNetworkEast.us">Food Network East</channel>
<channel site_id="9100001138#9233002271" xmltv_id="FoxEast.us">Fox East</channel>
<channel site_id="9100001138#9233000410" xmltv_id="FoxNewsChannel.us">Fox News Channel</channel>
<channel site_id="9100001138#9233008440" xmltv_id="FoxSports1.us">Fox Sports 1</channel>
<channel site_id="9100001138#9200006942" xmltv_id="FreeformEast.us">Freeform East</channel>
<channel site_id="9100001138#9233000028" xmltv_id="FuseEast.us">Fuse East</channel>
<channel site_id="9100001138#9200006932" xmltv_id="FXEast.us">FX East</channel>
<channel site_id="9100001138#9233013967" xmltv_id="FXMovieChannel.us">FX Movie Channel</channel>
<channel site_id="9100001138#9200018644" xmltv_id="FXXEast.us">FXX East</channel>
<channel site_id="9100001138#9200020460" xmltv_id="FYIEast.us">FYI East</channel>
<channel site_id="9100001138#9200019858" xmltv_id="GameShowNetworkEast.us">Game Show Network East</channel>
<channel site_id="9100001138#9233005443" xmltv_id="GolfChannelUS.us">Golf Channel US</channel>
<channel site_id="9100001138#9200016034" xmltv_id="HallmarkChannelEast.us">Hallmark Channel East</channel>
<channel site_id="9100001138#9233003524" xmltv_id="HBO2East.us">HBO 2 East</channel>
<channel site_id="9100001138#9200004886" xmltv_id="HBOEast.us">HBO East</channel>
<channel site_id="9100001138#9233008160" xmltv_id="HBOSignatureEast.us">HBO Signature East</channel>
<channel site_id="9100001138#9233004104" xmltv_id="HGTVEast.us">HGTV East</channel>
<channel site_id="9100001138#9233008002" xmltv_id="HistoryEast.us">History East</channel>
<channel site_id="9100001138#9200004303" xmltv_id="IFCEast.us">IFC East</channel>
<channel site_id="9100001138#9200002243" xmltv_id="InvestigationDiscoveryEast.us">Investigation Discovery East</channel>
<channel site_id="9100001138#9233011910" xmltv_id="IONTVEast.us">ION TV East</channel>
<channel site_id="9100001138#9200020452" xmltv_id="LifetimeEast.us">Lifetime East</channel>
<channel site_id="9100001138#9233009825" xmltv_id="LifetimeMoviesEast.us">Lifetime Movies East</channel>
<channel site_id="9100001138#9233001621" xmltv_id="LifetimeRealWomen.us">Lifetime Real Women</channel>
<channel site_id="9100001138#9233015766" xmltv_id="MoreMaxEast.us">MoreMax East</channel>
<channel site_id="9100001138#9233006803" xmltv_id="MSNBC.us">MSNBC</channel>
<channel site_id="9100001138#9200014754" xmltv_id="MTVEast.us">MTV East</channel>
<channel site_id="9100001138#9233001847" xmltv_id="MyNetworkTV.us">MyNetworkTV</channel>
<channel site_id="9100001138#9233002310" xmltv_id="NationalGeographicEast.us">National Geographic East</channel>
<channel site_id="9100001138#9233009876" xmltv_id="NBCEast.us">NBC East</channel>
<channel site_id="9100001138#9233000030" xmltv_id="NBCSN.us">NBCSN</channel>
<channel site_id="9100001138#9233013251" xmltv_id="NewsNationEast.us">NewsNation East</channel>
<channel site_id="9100001138#9200006939" xmltv_id="NickelodeonEast.us">Nickelodeon East</channel>
<channel site_id="9100001138#9200002736" xmltv_id="OprahWinfreyNetworkEast.us">Oprah Winfrey Network East</channel>
<channel site_id="9100001138#9200004949" xmltv_id="OxygenEast.us">Oxygen East</channel>
<channel site_id="9100001138#9233013810" xmltv_id="ParamountNetworkEast.us">Paramount Network East</channel>
<channel site_id="9100001138#9233004141" xmltv_id="PBSEast.us">PBS East</channel>
<channel site_id="9100001138#9200020464" xmltv_id="PopEast.us">Pop East</channel>
<channel site_id="9100001138#9200002891" xmltv_id="QVCUS.us">QVC US</channel>
<channel site_id="9100001138#9200011769" xmltv_id="Reelz.us">Reelz</channel>
<channel site_id="9100001138#9200019847" xmltv_id="Science.us">Science</channel>
<channel site_id="9100001138#9200018178" xmltv_id="Showtime2East.us">Showtime 2 East</channel>
<channel site_id="9100001138#9200016599" xmltv_id="ShowtimeEast.us">Showtime East</channel>
<channel site_id="9100001138#9233002112" xmltv_id="SmithsonianChannelEast.us">Smithsonian Channel East</channel>
<channel site_id="9100001138#9233013809" xmltv_id="StarzEast.us">Starz East</channel>
<channel site_id="9100001138#9200009649" xmltv_id="StarzEncoreEast.us">Starz Encore East</channel>
<channel site_id="9100001138#9233001687" xmltv_id="SundanceTVEast.us">Sundance TV East</channel>
<channel site_id="9100001138#9200004316" xmltv_id="SyfyEast.us">Syfy East</channel>
<channel site_id="9100001138#9233000403" xmltv_id="TBSEast.us">TBS East</channel>
<channel site_id="9100001138#9200017928" xmltv_id="TCMUS.us">TCM US</channel>
<channel site_id="9100001138#9200011857" xmltv_id="TelemundoEste.us">Telemundo Este</channel>
<channel site_id="9100001138#9233011398" xmltv_id="TheCWEast.us">The CW East</channel>
<channel site_id="9100001138#9233015305" xmltv_id="TheMovieChannelEast.us">The Movie Channel East</channel>
<channel site_id="9100001138#9233004112" xmltv_id="TLCEast.us">TLC East</channel>
<channel site_id="9100001138#9233011830" xmltv_id="TNTEast.us">TNT East</channel>
<channel site_id="9100001138#9233000035" xmltv_id="TravelChannelEast.us">Travel Channel East</channel>
<channel site_id="9100001138#9200009547" xmltv_id="truTVEast.us">truTV East</channel>
<channel site_id="9100001138#9233005468" xmltv_id="TVLandEast.us">TV Land East</channel>
<channel site_id="9100001138#9200012412" xmltv_id="TVG.us">TVG</channel>
<channel site_id="9100001138#9200000867" xmltv_id="UnivisionEast.us">Univisión East</channel>
<channel site_id="9100001138#9233004106" xmltv_id="USANetworkEast.us">USA Network East</channel>
<channel site_id="9100001138#9233000037" xmltv_id="VH1East.us">VH1 East</channel>
<channel site_id="9100001138#9200018188" xmltv_id="WeTVEast.us">We TV East</channel>
</channels>
</site>

View file

@ -0,0 +1,47 @@
const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc')
const timezone = require('dayjs/plugin/timezone')
dayjs.extend(utc)
dayjs.extend(timezone)
module.exports = {
lang: 'en',
site: 'tvguide.com',
channels: 'tvguide.com.channels.xml',
output: '.gh-pages/guides/tvguide.com.guide.xml',
url: function ({ date, channel }) {
const localTime = date.tz('America/New_York')
const parts = channel.site_id.split('#')
const start = localTime.startOf('d')
const duration = localTime.endOf('d').diff(start, 'm')
const url = `https://cmg-prod.apigee.net/v1/xapi/tvschedules/tvguide/${
parts[0]
}/web?start=${start.unix()}&duration=${duration}&channelSourceIds=${parts[1]}`
return url
},
parser: function ({ content }) {
const programs = []
const items = parseItems(content)
items.forEach(item => {
programs.push({
title: item.title,
start: parseTime(item.startTime),
stop: parseTime(item.endTime)
})
})
return programs
}
}
function parseTime(timestamp) {
return dayjs.unix(timestamp)
}
function parseItems(content) {
const json = JSON.parse(content)
return json.data.items[0].programSchedules
}

View file

@ -2437,7 +2437,7 @@
<channel site_id="7232" xmltv_id="MASN2.us" logo="https://cdn.tvpassport.com/image/station/100x100/masn.png">MASN2</channel> <channel site_id="7232" xmltv_id="MASN2.us" logo="https://cdn.tvpassport.com/image/station/100x100/masn.png">MASN2</channel>
<channel site_id="14771" xmltv_id="MBCAmerica.kr" logo="https://cdn.tvpassport.com/image/station/100x100/mbc-america.png">MBC America</channel> <channel site_id="14771" xmltv_id="MBCAmerica.kr" logo="https://cdn.tvpassport.com/image/station/100x100/mbc-america.png">MBC America</channel>
<channel site_id="14772" xmltv_id="WKTBCD5.us" logo="https://cdn.tvpassport.com/image/station/100x100/mbc-america.png">MBC America (WKTB-CD5)</channel> <channel site_id="14772" xmltv_id="WKTBCD5.us" logo="https://cdn.tvpassport.com/image/station/100x100/mbc-america.png">MBC America (WKTB-CD5)</channel>
<channel site_id="15014" xmltv_id="MBCDrama.us">MBC Drama (Korean)</channel> <channel site_id="15014" xmltv_id="MBCDrama.us">MBC Drama</channel>
<channel site_id="12630" xmltv_id="MCAETTV.us" logo="https://cdn.tvpassport.com/image/station/100x100/mcaet.png">MCAETv</channel> <channel site_id="12630" xmltv_id="MCAETTV.us" logo="https://cdn.tvpassport.com/image/station/100x100/mcaet.png">MCAETv</channel>
<channel site_id="18760" xmltv_id="K38JPD3.us" logo="https://cdn.tvpassport.com/image/station/100x100/mcaet.png">MCAETv (K38JP-DT3)</channel> <channel site_id="18760" xmltv_id="K38JPD3.us" logo="https://cdn.tvpassport.com/image/station/100x100/mcaet.png">MCAETv (K38JP-DT3)</channel>
<channel site_id="6107" xmltv_id="MGMHDUSA.us" logo="https://cdn.tvpassport.com/image/station/100x100/mgmhd.png">MGM HD USA</channel> <channel site_id="6107" xmltv_id="MGMHDUSA.us" logo="https://cdn.tvpassport.com/image/station/100x100/mgmhd.png">MGM HD USA</channel>

View file

@ -27,6 +27,7 @@
<channel site_id="6786" xmltv_id="ChampionTV3.id">Champions TV 2</channel> <channel site_id="6786" xmltv_id="ChampionTV3.id">Champions TV 2</channel>
<channel site_id="7648" xmltv_id="FoxSportsAsia.us">Fox Sports Asia</channel> <channel site_id="7648" xmltv_id="FoxSportsAsia.us">Fox Sports Asia</channel>
<channel site_id="6299" xmltv_id="beINSports1Asia.qa">beIN Sports 1 Asia</channel> <channel site_id="6299" xmltv_id="beINSports1Asia.qa">beIN Sports 1 Asia</channel>
<channel site_id="6317" xmltv_id="beINSports2Asia.qa">beIN Sports 2 Asia</channel>
<channel site_id="7649" xmltv_id="FoxSports2Asia.us">Fox Sports 2 Asia</channel> <channel site_id="7649" xmltv_id="FoxSports2Asia.us">Fox Sports 2 Asia</channel>
<channel site_id="7650" xmltv_id="FoxSports3Asia.us">Fox Sports 3 Asia</channel> <channel site_id="7650" xmltv_id="FoxSports3Asia.us">Fox Sports 3 Asia</channel>
<channel site_id="6784" xmltv_id="ArirangTV.kr">Arirang TV</channel> <channel site_id="6784" xmltv_id="ArirangTV.kr">Arirang TV</channel>

View file

@ -2,9 +2,11 @@ const jsdom = require('jsdom')
const { JSDOM } = jsdom const { JSDOM } = jsdom
const dayjs = require('dayjs') const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc') const utc = require('dayjs/plugin/utc')
const timezone = require('dayjs/plugin/timezone')
const customParseFormat = require('dayjs/plugin/customParseFormat') const customParseFormat = require('dayjs/plugin/customParseFormat')
dayjs.extend(utc) dayjs.extend(utc)
dayjs.extend(timezone)
dayjs.extend(customParseFormat) dayjs.extend(customParseFormat)
module.exports = { module.exports = {
@ -24,43 +26,52 @@ module.exports = {
return img ? img.dataset.src : null return img ? img.dataset.src : null
}, },
parser({ content, date }) { parser({ content, date }) {
const day = date.day() // 0 => Sunday
const programs = [] const programs = []
const dom = new JSDOM(content) const items = parseItems(content, date)
const tabs = dom.window.document.querySelectorAll(
`.elementor-tabs-content-wrapper > div[id*='elementor-tab-content']`
)
const items = tabs[day].querySelectorAll(`table > tbody > tr`)
items.forEach(item => { items.forEach(item => {
const row = (item.querySelector('td > p') || { textContent: '' }).textContent const title = parseTitle(item)
const parts = row.split(' ') const start = parseStart(item, date)
const time = parts.shift() const stop = parseStop(item, date)
const title = parts if (programs.length) {
.filter(str => str && /\S/g.test(str))
.map(i => i.trim())
.join(' ')
if (!time || !title) return false
const start = dayjs
.utc(time, 'HH:mm')
.set('D', date.get('D'))
.set('M', date.get('M'))
.set('y', date.get('y'))
if (!start.isValid()) return false
if (programs.length && !programs[programs.length - 1].stop) {
programs[programs.length - 1].stop = start programs[programs.length - 1].stop = start
} }
programs.push({ programs.push({ title, start, stop })
title,
start
})
}) })
return programs return programs
} }
} }
function parseStop(item, date) {
return date.endOf('d')
}
function parseStart(item, date) {
const row = (item.querySelector('td > p') || { textContent: '' }).textContent
let time = row.split(' ').shift()
time = `${date.format('MM/DD/YYYY')} ${time}`
return dayjs.tz(time, 'MM/DD/YYYY HH:mm', 'Africa/Lusaka')
}
function parseTitle(item) {
const row = (item.querySelector('td > p') || { textContent: '' }).textContent
const title = row.split(' ')
title.shift()
return title
.map(i => i.trim())
.filter(s => s)
.join(' ')
}
function parseItems(content, date) {
const day = date.day() // 0 => Sunday
const dom = new JSDOM(content)
const tabs = dom.window.document.querySelectorAll(
`.elementor-tabs-content-wrapper > div[id*='elementor-tab-content']`
)
return tabs[day].querySelectorAll(`table > tbody > tr:not(:first-child)`)
}