From 1733bbcec55f4e7943facd07ab3d91c21b296032 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Thu, 19 Aug 2021 20:00:04 +0300 Subject: [PATCH 01/23] Update tvtv.us.channels.xml --- sites/tvtv.us.channels.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sites/tvtv.us.channels.xml b/sites/tvtv.us.channels.xml index ffe99308..60675d52 100755 --- a/sites/tvtv.us.channels.xml +++ b/sites/tvtv.us.channels.xml @@ -2437,7 +2437,7 @@ MASN2 MBC America MBC America (WKTB-CD5) - MBC Drama (Korean) + MBC Drama MCAETv MCAETv (K38JP-DT3) MGM HD USA From f8727a3a3f865692192c9ff578b86fb5df400386 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Mon, 23 Aug 2021 15:57:44 +0300 Subject: [PATCH 02/23] Delete albepg.com.channels.xml --- sites/albepg.com.channels.xml | 124 ---------------------------------- 1 file changed, 124 deletions(-) delete mode 100755 sites/albepg.com.channels.xml diff --git a/sites/albepg.com.channels.xml b/sites/albepg.com.channels.xml deleted file mode 100755 index 15864a2d..00000000 --- a/sites/albepg.com.channels.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - 21 Junior - 21 Popullore - 24 Kitchen Srbija - 3 Plus - ABC News - AlbUK TV - Alsat - Animal Planet Europe - Arena Sport 1 - Arena Sport 2 - Arena Sport 3 - Arena Sport 4 - Arta - BBF Music TV - BabyTV Europe - Balkanika TV - Bang Bang - Boomerang EMEA - Click TV - Discovery Channel Bulgaria - Elrodi TV - Euronews Albania - Eurosport 1 - Explorer Histori - Explorer Natyra - Explorer Shkencë - Family HD - FashionTV Europe - Film Aksion - Film Drame - Film Dy HD - Film Hits - Film Hits +1 - Film Komedi - Film Një HD - Film Thriller - Folk+ - Fox Life Regional - Fox Srbija - In TV - Investigation Discovery Europe - Junior TV - Kanal 10 - Kanal D Drama - Kanali 7 - Klan Kosova - Klan Macedonia - Klan Plus - Kohavision - Living HD - MFM - MTV Live HD - Muse - My Music - National Geographic Channel HD Europe - Nesër TV - News 24 - On-TV - Ora News - Peace TV English - RTSH 1 - RTSH 2 - RTSH 3 - RTSH Agro - RTSH Femije - RTSH Film - RTSH Korca - RTSH Muzikë - RTSH Plus - RTSH Shkolle - RTSH Shqip - RTSH Sport - RTV21 - STV Folk - Stinët - Super Sonic TV - SuperSport 1 - SuperSport 2 - SuperSport 3 - SuperSport 4 - SuperSport 5 - SuperSport 6 - SuperSport Kosova 1 - SuperSport Kosova 2 - SuperSport Kosova 3 - T7 - TV 21 Macedonia - TV Klan - TV Koha - TV Shenja - TV Tetova - TVM2 - Telesport - Tip TV - Top Channel - Top News - Tribuna Channel - Tring Action - Tring Comedy - Tring Family - Tring Fantasy - Tring History - Tring International - Tring Jolly - Tring Kids - Tring Life - Tring Planet - Tring Shqip - Tring Smile - Tring Sport 1 - Tring Sport 2 - Tring Sport 3 - Tring Sport 4 - Tring Sport News - Tring Super - Tring Tring - Tring World - Vizion Plus - Çufo - - \ No newline at end of file From a9dc6f593acb0f6ff53d56a04ec83f3479f8844d Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Mon, 23 Aug 2021 15:57:47 +0300 Subject: [PATCH 03/23] Delete albepg.com.config.js --- sites/albepg.com.config.js | 51 -------------------------------------- 1 file changed, 51 deletions(-) delete mode 100644 sites/albepg.com.config.js diff --git a/sites/albepg.com.config.js b/sites/albepg.com.config.js deleted file mode 100644 index dcfe09fb..00000000 --- a/sites/albepg.com.config.js +++ /dev/null @@ -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 - } -} From 3e7d6a69a30a6a1e20b8f85109248f21b4c7e89c Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Mon, 23 Aug 2021 15:57:51 +0300 Subject: [PATCH 04/23] Update auto-update.yml --- .github/workflows/auto-update.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/auto-update.yml b/.github/workflows/auto-update.yml index 99411305..12685ff1 100644 --- a/.github/workflows/auto-update.yml +++ b/.github/workflows/auto-update.yml @@ -18,7 +18,6 @@ jobs: hd-plus.de, astro.com.my, comteco.com.bo, - albepg.com, mi.tv, meo.pt, tvgid.ua, From c3cbf42231dd6ac07dbfdd37c722511d89f125d6 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Mon, 23 Aug 2021 15:57:54 +0300 Subject: [PATCH 05/23] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index fa8767c7..cbd77a52 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,6 @@ To load a program guide, all you need to do is copy the link to one of the guide CountryEPG - 🇦🇱 Albaniahttps://iptv-org.github.io/epg/guides/albepg.com.guide.xml 🇦🇩 Andorrahttps://iptv-org.github.io/epg/guides/andorradifusio.ad.guide.xml 🇦🇷 Argentinahttps://iptv-org.github.io/epg/guides/mi.tv.guide.xml 🇦🇺 Australiahttps://iptv-org.github.io/epg/guides/ontvtonight.com.guide.xml From fbe7787aaaf2e420f931447b4f901acfc689669a Mon Sep 17 00:00:00 2001 From: mobilegear Date: Thu, 26 Aug 2021 14:28:45 +0700 Subject: [PATCH 06/23] Update vidio.com.channels.xml --- sites/vidio.com.channels.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/sites/vidio.com.channels.xml b/sites/vidio.com.channels.xml index 527e0676..748cde94 100644 --- a/sites/vidio.com.channels.xml +++ b/sites/vidio.com.channels.xml @@ -27,6 +27,7 @@ Champions TV 2 Fox Sports Asia beIN Sports 1 Asia + beIN Sports 2 Asia Fox Sports 2 Asia Fox Sports 3 Asia Arirang TV From 22b197d3f46fd2a4e57fee03ce43d6be32c0a7e5 Mon Sep 17 00:00:00 2001 From: "iptv-bot[bot]" <84861620+iptv-bot[bot]@users.noreply.github.com> Date: Fri, 27 Aug 2021 03:50:08 +0300 Subject: [PATCH 07/23] [Bot] Update codes (#54) Co-authored-by: freearhey --- codes.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/codes.csv b/codes.csv index 2ae650d2..998dbacc 100644 --- a/codes.csv +++ b/codes.csv @@ -858,6 +858,7 @@ beIN Sports 11,beINSports11.qa beIN Sports 12,beINSports12.qa beIN Sports 13,beINSports13.qa beIN Sports 2,beINSports2.qa +beIN Sports 2 Asia,beINSports2Asia.qa beIN Sports 3,beINSports3.qa beIN Sports Canada,beINSportsCanada.qa beIN Sports en Español,beINSportsenEspanol.qa From d394c40e93652d3d02b1b58bdc578fbbdd5d42e0 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Fri, 27 Aug 2021 16:05:09 +0300 Subject: [PATCH 08/23] Create tvguide.com.config.js --- sites/tvguide.com.config.js | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 sites/tvguide.com.config.js diff --git a/sites/tvguide.com.config.js b/sites/tvguide.com.config.js new file mode 100644 index 00000000..f6c13ac1 --- /dev/null +++ b/sites/tvguide.com.config.js @@ -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 +} From 1b13eb3397b5c4dc1c7ae0e5a67e9dbdc3dcbfec Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Fri, 27 Aug 2021 16:05:20 +0300 Subject: [PATCH 09/23] Create tvguide.com.channels.xml --- sites/tvguide.com.channels.xml | 93 ++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100755 sites/tvguide.com.channels.xml diff --git a/sites/tvguide.com.channels.xml b/sites/tvguide.com.channels.xml new file mode 100755 index 00000000..5ad87d8e --- /dev/null +++ b/sites/tvguide.com.channels.xml @@ -0,0 +1,93 @@ + + + + A&E East + ABC East + AMC East + Animal Planet East + BBC America East + BET East + Bravo East + Cartoon Network East + CBS East + Cinemax East + CMT East + CNBC US + CNN USA + Comedy Central East + Discovery Channel East + Discovery Life Channel + Disney Channel East + Disney XD East + DIY Network USA + E! East + ESPN + ESPN 2 US + ESPN Classic USA + ESPNU + Flix East + Food Network East + Fox East + Fox News Channel + Fox Sports 1 + Freeform East + Fuse East + FX East + FX Movie Channel + FXX East + FYI East + Game Show Network East + Golf Channel US + Hallmark Channel East + HBO 2 East + HBO East + HBO Signature East + HGTV East + History East + IFC East + Investigation Discovery East + ION TV East + Lifetime East + Lifetime Movies East + Lifetime Real Women + MoreMax East + MSNBC + MTV East + MyNetworkTV + National Geographic East + NBC East + NBCSN + NewsNation East + Nickelodeon East + Oprah Winfrey Network East + Oxygen East + Paramount Network East + PBS East + Pop East + QVC US + Reelz + Science + Showtime 2 East + Showtime East + Smithsonian Channel East + Starz East + Starz Encore East + Sundance TV East + Syfy East + TBS East + TCM US + Telemundo Este + The CW East + The Movie Channel East + TLC East + TNT East + Travel Channel East + truTV East + TV Land East + TVG + Univisión East + USA Network East + VH1 East + We TV East + + \ No newline at end of file From f5cfe0d1045b443541c61a254a65efc1e6afbb96 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Fri, 27 Aug 2021 16:05:23 +0300 Subject: [PATCH 10/23] Update auto-update.yml --- .github/workflows/auto-update.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/auto-update.yml b/.github/workflows/auto-update.yml index 99411305..b2d22d22 100644 --- a/.github/workflows/auto-update.yml +++ b/.github/workflows/auto-update.yml @@ -35,7 +35,8 @@ jobs: tvtv.ca, tvtv.us, tv.lv, - vidio.com + vidio.com, + tvguide.com ] steps: - name: Checkout From baddd7eee0513dfd2dba31877c7a2f447a36768b Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Fri, 27 Aug 2021 17:22:21 +0300 Subject: [PATCH 11/23] Update meo.pt.channels.xml --- sites/meo.pt.channels.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sites/meo.pt.channels.xml b/sites/meo.pt.channels.xml index 8b41aff9..9a55f5d8 100755 --- a/sites/meo.pt.channels.xml +++ b/sites/meo.pt.channels.xml @@ -114,5 +114,9 @@ i24 News English i24 News Français Первый канал + TVCine Top + TVCine Edition + TVCine Emotion + TVCine Action \ No newline at end of file From a6be3a5ad4fa1d583efbba482e8e909899736892 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Fri, 27 Aug 2021 20:26:11 +0300 Subject: [PATCH 12/23] Update mi.tv.config.js --- sites/mi.tv.config.js | 61 ++++++++++++++++++++++++++++--------------- 1 file changed, 40 insertions(+), 21 deletions(-) diff --git a/sites/mi.tv.config.js b/sites/mi.tv.config.js index 94cdfbe7..27820789 100644 --- a/sites/mi.tv.config.js +++ b/sites/mi.tv.config.js @@ -2,11 +2,14 @@ const jsdom = require('jsdom') const { JSDOM } = jsdom const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') +const timezone = require('dayjs/plugin/timezone') const customParseFormat = require('dayjs/plugin/customParseFormat') dayjs.extend(utc) +dayjs.extend(timezone) dayjs.extend(customParseFormat) +let PM = false module.exports = { lang: 'pt', site: 'mi.tv', @@ -23,32 +26,48 @@ module.exports = { }, parser({ content, date }) { const programs = [] - const dom = new JSDOM(content) - const items = dom.window.document.querySelectorAll('#listings > ul > li') + const items = parseItems(content) items.forEach(item => { - const title = (item.querySelector('a > div.content > h2') || { textContent: '' }).textContent - const time = (item.querySelector('a > div.content > span.time') || { textContent: '' }) - .textContent - - if (title && time) { - 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.push({ - title, - start - }) + const title = parseTitle(item) + let start = parseStart(item, date) + if (!start) return + if (start.hour() > 11) PM = true + if (start.hour() < 12 && PM) start = start.add(1, 'd') + const stop = parseStop(item, start) + if (programs.length) { + programs[programs.length - 1].stop = start } + + programs.push({ + title, + start, + stop + }) }) 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') +} From 8a963da78c1b35d86b937da6ffaa8c494d5732b0 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Fri, 27 Aug 2021 21:00:48 +0300 Subject: [PATCH 13/23] Update andorradifusio.ad.config.js --- sites/andorradifusio.ad.config.js | 68 +++++++++++++++++++++---------- 1 file changed, 47 insertions(+), 21 deletions(-) diff --git a/sites/andorradifusio.ad.config.js b/sites/andorradifusio.ad.config.js index 476da9f6..175f4324 100644 --- a/sites/andorradifusio.ad.config.js +++ b/sites/andorradifusio.ad.config.js @@ -2,11 +2,14 @@ const jsdom = require('jsdom') const { JSDOM } = jsdom const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') +const timezone = require('dayjs/plugin/timezone') const customParseFormat = require('dayjs/plugin/customParseFormat') dayjs.extend(utc) +dayjs.extend(timezone) dayjs.extend(customParseFormat) +let PM = false module.exports = { lang: 'ca', site: 'andorradifusio.ad', @@ -16,36 +19,59 @@ module.exports = { return `https://www.andorradifusio.ad/programacio/${channel.site_id}` }, parser({ content, date }) { - const day = date.day() - 1 const programs = [] - const dom = new JSDOM(content) - const cols = dom.window.document.querySelectorAll('.programacio-dia') - const colNum = day < 0 ? 6 : day - const times = cols[colNum].querySelectorAll(`h4`) - const titles = cols[colNum].querySelectorAll(`p`) - - times.forEach((time, i) => { - const title = titles[i] ? titles[i].textContent : null - 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) { + const items = parseItems(content, date) + items.forEach(item => { + const title = parseTitle(item) + let start = parseStart(item, date) + if (start.hour() > 11) PM = true + if (start.hour() < 12 && PM) start = start.add(1, 'd') + const stop = parseStop(item, date) + if (programs.length) { programs[programs.length - 1].stop = start } programs.push({ title, - start + start, + stop }) }) 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 +} From 12c0bf33e99b06d4713202653d32702229312697 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Fri, 27 Aug 2021 21:23:24 +0300 Subject: [PATCH 14/23] Update comteco.com.bo.config.js --- sites/comteco.com.bo.config.js | 63 +++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/sites/comteco.com.bo.config.js b/sites/comteco.com.bo.config.js index 6def9c7a..021c913e 100644 --- a/sites/comteco.com.bo.config.js +++ b/sites/comteco.com.bo.config.js @@ -2,9 +2,11 @@ const jsdom = require('jsdom') const { JSDOM } = jsdom const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') +const timezone = require('dayjs/plugin/timezone') const customParseFormat = require('dayjs/plugin/customParseFormat') dayjs.extend(utc) +dayjs.extend(timezone) dayjs.extend(customParseFormat) module.exports = { @@ -25,38 +27,43 @@ module.exports = { }, parser: function ({ content, date }) { const programs = [] - const dom = new JSDOM(content) - const items = dom.window.document.querySelectorAll('#datosasociados > div > .list-group-item') + const items = parseItems(content) 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() - }) + const title = parseTitle(item) + let start = parseStart(item, date) + const stop = parseStop(item, date) + if (programs.length) { + programs[programs.length - 1].stop = start } + + programs.push({ title, start, stop }) }) 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') +} From 6f9e5189c42ba1db704cd903185472d1c99c89eb Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Fri, 27 Aug 2021 22:07:00 +0300 Subject: [PATCH 15/23] Update hd-plus.de.config.js --- sites/hd-plus.de.config.js | 55 +++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 21 deletions(-) diff --git a/sites/hd-plus.de.config.js b/sites/hd-plus.de.config.js index 2ad6cc01..6016d13a 100644 --- a/sites/hd-plus.de.config.js +++ b/sites/hd-plus.de.config.js @@ -2,12 +2,12 @@ const jsdom = require('jsdom') const { JSDOM } = jsdom const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') -const customParseFormat = require('dayjs/plugin/customParseFormat') const timezone = require('dayjs/plugin/timezone') +const customParseFormat = require('dayjs/plugin/customParseFormat') dayjs.extend(utc) -dayjs.extend(customParseFormat) dayjs.extend(timezone) +dayjs.extend(customParseFormat) module.exports = { lang: 'de', @@ -26,29 +26,42 @@ module.exports = { return img ? img.src : null }, - parser({ content }) { - const dom = new JSDOM(content) - const items = dom.window.document.querySelectorAll('table > tbody > tr') - let programs = [] + parser({ content, date }) { + const programs = [] + const items = parseItems(content) items.forEach(item => { - const title = (item.querySelector('td:nth-child(1) > a') || { textContent: '' }).textContent - const fullDate = (item.querySelector('td:nth-child(2)') || { textContent: '' }).textContent - if (title && fullDate) { - const time = fullDate.split(' ').pop() - 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.push({ - title, - start - }) + const title = parseTitle(item) + let start = parseStart(item, date) + const stop = parseStop(item, date) + if (programs.length) { + programs[programs.length - 1].stop = start } + + programs.push({ title, start, stop }) }) return programs } } + +function parseStop(item, date) { + return date.tz('Europe/Berlin').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') +} From 32fdf396dfba87d014c008e0f44628906be8f8d3 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Fri, 27 Aug 2021 23:27:14 +0300 Subject: [PATCH 16/23] Update m.tv.sms.cz.config.js --- sites/m.tv.sms.cz.config.js | 80 ++++++++++++++++++++++--------------- 1 file changed, 47 insertions(+), 33 deletions(-) diff --git a/sites/m.tv.sms.cz.config.js b/sites/m.tv.sms.cz.config.js index cef55833..d34a0490 100644 --- a/sites/m.tv.sms.cz.config.js +++ b/sites/m.tv.sms.cz.config.js @@ -3,13 +3,14 @@ const iconv = require('iconv-lite') const { JSDOM } = jsdom const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') -var customParseFormat = require('dayjs/plugin/customParseFormat') -var timezone = require('dayjs/plugin/timezone') +const timezone = require('dayjs/plugin/timezone') +const customParseFormat = require('dayjs/plugin/customParseFormat') dayjs.extend(utc) -dayjs.extend(customParseFormat) dayjs.extend(timezone) +dayjs.extend(customParseFormat) +let PM = false module.exports = { lang: 'cs', site: 'm.tv.sms.cz', @@ -28,40 +29,53 @@ module.exports = { }, parser: function ({ buffer, date }) { const programs = [] - const string = iconv.decode(buffer, 'win1250') - const dom = new JSDOM(string) - const items = dom.window.document.querySelectorAll('#obsah > div > div.porady > div.porad') + const items = parseItems(buffer) items.forEach((item, i) => { - const time = (item.querySelector('div > span') || { textContent: '' }).textContent - .toString() - .trim() - const title = (item.querySelector('a > div') || { textContent: '' }).textContent - .toString() - .trim() - const description = (item.querySelector('a > div.detail') || { textContent: '' }).textContent - .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.push({ - title, - description, - start - }) + const title = parseTitle(item) + const description = parseDescription(item) + const start = parseStart(item, date) + if (start.hour() > 11) PM = true + if (start.hour() < 12 && PM) start = start.add(1, 'd') + const stop = parseStop(item, date) + if (programs.length) { + programs[programs.length - 1].stop = start } + + programs.push({ + title, + description, + start, + stop + }) }) 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') +} From 3925a8bace2544244bb79e3843a9d6bc93217dad Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Fri, 27 Aug 2021 23:53:26 +0300 Subject: [PATCH 17/23] Update programtv.onet.pl.config.js --- sites/programtv.onet.pl.config.js | 61 ++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 18 deletions(-) diff --git a/sites/programtv.onet.pl.config.js b/sites/programtv.onet.pl.config.js index 9c4baf6c..36568388 100644 --- a/sites/programtv.onet.pl.config.js +++ b/sites/programtv.onet.pl.config.js @@ -2,11 +2,14 @@ const jsdom = require('jsdom') const { JSDOM } = jsdom const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') +const timezone = require('dayjs/plugin/timezone') const customParseFormat = require('dayjs/plugin/customParseFormat') dayjs.extend(utc) +dayjs.extend(timezone) dayjs.extend(customParseFormat) +let PM = false module.exports = { lang: 'pl', site: 'programtv.onet.pl', @@ -24,24 +27,16 @@ module.exports = { }, parser: function ({ content, date }) { const programs = [] - const dom = new JSDOM(content) - const items = dom.window.document.querySelectorAll( - '#channelTV > section > div.emissions > ul > li' - ) - + const items = parseItems(content) items.forEach(item => { - const title = (item.querySelector('.titles > a') || { textContent: '' }).textContent - const description = (item.querySelector('.titles > p') || { textContent: '' }).textContent - const category = (item.querySelector('.titles > .type') || { textContent: '' }).textContent - const hour = (item.querySelector('.hours > .hour') || { textContent: '' }).textContent - - const start = dayjs - .utc(hour, 'H:mm') - .set('D', date.get('D')) - .set('M', date.get('M')) - .set('y', date.get('y')) - - if (programs.length && !programs[programs.length - 1].stop) { + const title = parseTitle(item) + const description = parseDescription(item) + const category = parseCategory(item) + let start = parseStart(item, date) + if (start.hour() > 11) PM = true + if (start.hour() < 12 && PM) start = start.add(1, 'd') + const stop = parseStop(item, date) + if (programs.length) { programs[programs.length - 1].stop = start } @@ -49,10 +44,40 @@ module.exports = { title, description, category, - start + start, + stop }) }) return programs } } + +function parseStop(item, date) { + return date.tz('Europe/Warsaw').endOf('d').add(6, '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') +} From 1e4b9e8971fc13c81b5858718219a0099494ec48 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sat, 28 Aug 2021 01:48:40 +0300 Subject: [PATCH 18/23] Update tvgid.ua.config.js --- sites/tvgid.ua.config.js | 65 +++++++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 24 deletions(-) diff --git a/sites/tvgid.ua.config.js b/sites/tvgid.ua.config.js index 511dbb6b..b54fca8a 100644 --- a/sites/tvgid.ua.config.js +++ b/sites/tvgid.ua.config.js @@ -3,11 +3,14 @@ const iconv = require('iconv-lite') const { JSDOM } = jsdom const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') +const timezone = require('dayjs/plugin/timezone') const customParseFormat = require('dayjs/plugin/customParseFormat') dayjs.extend(utc) +dayjs.extend(timezone) dayjs.extend(customParseFormat) +let PM = false module.exports = { lang: 'uk', site: 'tvgid.ua', @@ -18,36 +21,50 @@ module.exports = { }, parser: function ({ buffer, date }) { const programs = [] - const string = iconv.decode(buffer, 'win1251') - 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' - ) - + const items = parseItems(buffer) items.forEach(item => { - const time = (item.querySelector('td > table > tbody > tr > td.time') || { textContent: '' }) - .textContent - const title = ( - item.querySelector('td > table > tbody > tr > td.item > a') || - item.querySelector('td > table > tbody > tr > td.item') || { textContent: '' } - ).textContent - - 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) { + const title = parseTitle(item) + let start = parseStart(item, date) + if (!start) return + if (start.hour() > 11) PM = true + if (start.hour() < 12 && PM) start = start.add(1, 'd') + const stop = parseStop(item, start) + if (programs.length) { programs[programs.length - 1].stop = start } - programs.push({ - title, - start - }) + programs.push({ title, start, stop }) }) 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)' + ) +} From 1489992f001590cfbc084a26147806fb091e205e Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sat, 28 Aug 2021 02:26:22 +0300 Subject: [PATCH 19/23] Update znbc.co.zm.config.js --- sites/znbc.co.zm.config.js | 71 ++++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 30 deletions(-) diff --git a/sites/znbc.co.zm.config.js b/sites/znbc.co.zm.config.js index f36d259a..eded142b 100644 --- a/sites/znbc.co.zm.config.js +++ b/sites/znbc.co.zm.config.js @@ -2,9 +2,11 @@ const jsdom = require('jsdom') const { JSDOM } = jsdom const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') +const timezone = require('dayjs/plugin/timezone') const customParseFormat = require('dayjs/plugin/customParseFormat') dayjs.extend(utc) +dayjs.extend(timezone) dayjs.extend(customParseFormat) module.exports = { @@ -24,43 +26,52 @@ module.exports = { return img ? img.dataset.src : null }, parser({ content, date }) { - const day = date.day() // 0 => Sunday const programs = [] - const dom = new JSDOM(content) - const tabs = dom.window.document.querySelectorAll( - `.elementor-tabs-content-wrapper > div[id*='elementor-tab-content']` - ) - const items = tabs[day].querySelectorAll(`table > tbody > tr`) - + const items = parseItems(content, date) items.forEach(item => { - const row = (item.querySelector('td > p') || { textContent: '' }).textContent - const parts = row.split(' ') - const time = parts.shift() - const title = parts - .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) { + const title = parseTitle(item) + const start = parseStart(item, date) + const stop = parseStop(item, start) + if (programs.length) { programs[programs.length - 1].stop = start } - programs.push({ - title, - start - }) + programs.push({ title, start, stop }) }) 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)`) +} From 59ec56693c6d123165461da92d778df180d7a07b Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sat, 28 Aug 2021 02:39:37 +0300 Subject: [PATCH 20/23] Update programtv.onet.pl.config.js --- sites/programtv.onet.pl.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sites/programtv.onet.pl.config.js b/sites/programtv.onet.pl.config.js index 36568388..19e61d8a 100644 --- a/sites/programtv.onet.pl.config.js +++ b/sites/programtv.onet.pl.config.js @@ -54,7 +54,7 @@ module.exports = { } function parseStop(item, date) { - return date.tz('Europe/Warsaw').endOf('d').add(6, 'h') + return date.add(1, 'd').hour(3).startOf('h') } function parseStart(item, date) { From 7bbca8e0adbb44cdaf0bffe894ab1bb94a53c40b Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sat, 28 Aug 2021 03:01:10 +0300 Subject: [PATCH 21/23] Update znbc.co.zm.config.js --- sites/znbc.co.zm.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sites/znbc.co.zm.config.js b/sites/znbc.co.zm.config.js index eded142b..7f078b55 100644 --- a/sites/znbc.co.zm.config.js +++ b/sites/znbc.co.zm.config.js @@ -31,7 +31,7 @@ module.exports = { items.forEach(item => { const title = parseTitle(item) const start = parseStart(item, date) - const stop = parseStop(item, start) + const stop = parseStop(item, date) if (programs.length) { programs[programs.length - 1].stop = start } From 277a79ac6e32dd7e9ddbc70bcf5e8050e90f7a33 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sat, 28 Aug 2021 03:05:31 +0300 Subject: [PATCH 22/23] Update hd-plus.de.config.js --- sites/hd-plus.de.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sites/hd-plus.de.config.js b/sites/hd-plus.de.config.js index 6016d13a..e69ec966 100644 --- a/sites/hd-plus.de.config.js +++ b/sites/hd-plus.de.config.js @@ -45,7 +45,7 @@ module.exports = { } function parseStop(item, date) { - return date.tz('Europe/Berlin').endOf('d') + return date.endOf('d') } function parseStart(item, date) { From b642a6080c70687068e7953e4d883a180b90cb0c Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sat, 28 Aug 2021 03:17:33 +0300 Subject: [PATCH 23/23] Update m.tv.sms.cz.config.js --- sites/m.tv.sms.cz.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sites/m.tv.sms.cz.config.js b/sites/m.tv.sms.cz.config.js index d34a0490..e820ef0d 100644 --- a/sites/m.tv.sms.cz.config.js +++ b/sites/m.tv.sms.cz.config.js @@ -33,7 +33,7 @@ module.exports = { items.forEach((item, i) => { const title = parseTitle(item) const description = parseDescription(item) - const start = parseStart(item, date) + let start = parseStart(item, date) if (start.hour() > 11) PM = true if (start.hour() < 12 && PM) start = start.add(1, 'd') const stop = parseStop(item, date)