From 067e9f04b7cd61e5ff12d1edf35e3bb489118b7e Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Wed, 22 Nov 2023 22:39:17 +0300 Subject: [PATCH 1/5] Create content.html --- sites/tvireland.ie/__data__/content.html | 543 +++++++++++++++++++++++ 1 file changed, 543 insertions(+) create mode 100644 sites/tvireland.ie/__data__/content.html diff --git a/sites/tvireland.ie/__data__/content.html b/sites/tvireland.ie/__data__/content.html new file mode 100644 index 00000000..01327c25 --- /dev/null +++ b/sites/tvireland.ie/__data__/content.html @@ -0,0 +1,543 @@ + + +Virgin Media More - Irish TV Guide | TV Ireland + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + +
+
+ + +
+ +
+ Virgin Media More +
+

Virgin Media More

+
+
Find out what's on Virgin Media More tonight at TV Ireland
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
Time
+
+
TV Show
+
+
12:20 am
+
+
+ + + Best of Rugby World Cup
+ + + +
+
01:10 am
+
+
+ + + Sport Stories: Joe Brolly
+ + + +
+
02:00 am
+
+
+ + + Close
+ + + +
+
1:20 pm
+
+
+ + + Rugby World Cup Archive Matches
+ + + +
+
3:20 pm
+
+
+ + + Live UEFA Europa Conference League
+ + + +
+
5:30 pm
+
+
+ + + Sport Stories: Sheamus
+ + + +
+
5:55 pm
+
+
+ + + UEFA Europa League & Europa Conference League Magazine
+ + + +
+
6:45 pm
+
+
+ + + UEFA European Qualifiers
+ + + +
+
8:30 pm
+
+
+ + + UEFA Champions League Magazine Show
+ + + +
+
9:00 pm
+
+
+ + + I Kissed a Boy
+ + + +
+
10:00 pm
+
+
+ + + Schitt's Creek
+ + + +
+
10:15 pm
+
+
+ + + Schitt's Creek
+ + + +
+
10:40 pm
+
+
+ + + Kavos Weekender
+ + + +
+
11:30 pm
+
+
+ + + Stories from the Street
+ + + +
+
+ More channels at TV Ireland..
+


+
+
+ + +
+ + +
+ +
+
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 235b1c5b7ff0316386df25a147dca4f56d3ae550 Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Wed, 22 Nov 2023 22:39:20 +0300 Subject: [PATCH 2/5] Create tvireland.ie.test.js --- sites/tvireland.ie/tvireland.ie.test.js | 53 +++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 sites/tvireland.ie/tvireland.ie.test.js diff --git a/sites/tvireland.ie/tvireland.ie.test.js b/sites/tvireland.ie/tvireland.ie.test.js new file mode 100644 index 00000000..37645924 --- /dev/null +++ b/sites/tvireland.ie/tvireland.ie.test.js @@ -0,0 +1,53 @@ +// npm run channels:parse -- --config=./sites/tvireland.ie/tvireland.ie.config.js --output=./sites/tvireland.ie/tvireland.ie.channels.xml +// npm run grab -- --site=tvireland.ie + +const { parser, url } = require('./tvireland.ie.config.js') +const fs = require('fs') +const path = require('path') +const dayjs = require('dayjs') +const utc = require('dayjs/plugin/utc') +const customParseFormat = require('dayjs/plugin/customParseFormat') +dayjs.extend(customParseFormat) +dayjs.extend(utc) + +const date = dayjs.utc('2023-11-25', 'YYYY-MM-DD').startOf('d') +const channel = { + site_id: '2378/virgin-media-more', + xmltv_id: 'VirginMediaMore.ie' +} + +it('can generate valid url', () => { + expect(url({ channel, date })).toBe( + 'https://www.tvireland.ie/tv/listings/channel/2378/virgin-media-more?dt=2023-11-25' + ) +}) + +it('can parse response', () => { + const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.html')) + const results = parser({ content, channel, date }).map(p => { + p.start = p.start.toJSON() + p.stop = p.stop.toJSON() + return p + }) + + expect(results[0]).toMatchObject({ + start: '2023-11-25T00:20:00.000Z', + stop: '2023-11-25T01:10:00.000Z', + title: 'Best of Rugby World Cup' + }) + + expect(results[13]).toMatchObject({ + start: '2023-11-25T23:30:00.000Z', + stop: '2023-11-26T00:00:00.000Z', + title: 'Stories from the Street' + }) +}) + +it('can handle empty guide', () => { + const result = parser({ + date, + channel, + content: '' + }) + expect(result).toMatchObject([]) +}) From a55433d27bee3c26fd902a93384917c566366c8e Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Wed, 22 Nov 2023 22:39:24 +0300 Subject: [PATCH 3/5] Create tvireland.ie.config.js --- sites/tvireland.ie/tvireland.ie.config.js | 99 +++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 sites/tvireland.ie/tvireland.ie.config.js diff --git a/sites/tvireland.ie/tvireland.ie.config.js b/sites/tvireland.ie/tvireland.ie.config.js new file mode 100644 index 00000000..93e712af --- /dev/null +++ b/sites/tvireland.ie/tvireland.ie.config.js @@ -0,0 +1,99 @@ +const cheerio = require('cheerio') +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 = { + site: 'tvireland.ie', + days: 2, + url: function ({ date, channel }) { + return `https://www.tvireland.ie/tv/listings/channel/${channel.site_id}?dt=${date.format( + 'YYYY-MM-DD' + )}` + }, + parser: function ({ content, date, channel }) { + const programs = [] + const items = parseItems(content) + items.forEach(item => { + const prev = programs[programs.length - 1] + const $item = cheerio.load(item) + let start = parseStart($item, date, channel) + if (prev) { + if (start.isBefore(prev.start)) { + start = start.add(1, 'd') + date = date.add(1, 'd') + } + prev.stop = start + } + const stop = start.add(30, 'm') + programs.push({ + title: parseTitle($item), + start, + stop + }) + }) + + return programs + }, + async channels() { + const axios = require('axios') + const _ = require('lodash') + + const providers = ['-9000019', '-8000019', '-1000019', '-2000019', '-7000019'] + + const channels = [] + for (let provider of providers) { + const data = await axios + .post(`https://www.tvireland.ie/tv/schedule`, null, { + params: { + provider, + region: 'Ireland', + TVperiod: 'Night', + date: dayjs().format('YYYY-MM-DD'), + st: 0, + u_time: 2027, + is_mobile: 1 + } + }) + .then(r => r.data) + .catch(console.log) + + const $ = cheerio.load(data) + $('.channelname').each((i, el) => { + const name = $(el).find('center > a:eq(1)').text() + const url = $(el).find('center > a:eq(1)').attr('href') + const [, number, slug] = url.match(/\/(\d+)\/(.*)\.html$/) + + channels.push({ + lang: 'en', + name, + site_id: `${number}/${slug}` + }) + }) + } + + return _.uniqBy(channels, 'site_id') + } +} + +function parseStart($item, date, channel) { + const timeString = $item('td:eq(0)').text().trim() + const dateString = `${date.format('YYYY-MM-DD')} ${timeString}` + + return dayjs.tz(dateString, 'YYYY-MM-DD H:mm a', 'Europe/Dublin') +} + +function parseTitle($item) { + return $item('td:eq(1)').text().trim() +} + +function parseItems(content) { + const $ = cheerio.load(content) + + return $('table.table > tbody > tr').toArray() +} From ff0eb633916a4961853e9bd00b8cab69a162f0c4 Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Wed, 22 Nov 2023 22:39:27 +0300 Subject: [PATCH 4/5] Create tvireland.ie.channels.xml --- sites/tvireland.ie/tvireland.ie.channels.xml | 337 +++++++++++++++++++ 1 file changed, 337 insertions(+) create mode 100644 sites/tvireland.ie/tvireland.ie.channels.xml diff --git a/sites/tvireland.ie/tvireland.ie.channels.xml b/sites/tvireland.ie/tvireland.ie.channels.xml new file mode 100644 index 00000000..f955860e --- /dev/null +++ b/sites/tvireland.ie/tvireland.ie.channels.xml @@ -0,0 +1,337 @@ + + + + 4Music + Alibi + Alibi HD + Alibi +1 + Al Jazeera English HD + Animal Planet + Animal Planet +1 + Arirang HD + B4U Movies + B4U Music + Baby TV + BBC Alba + BBC Alba HD + BBC Four + BBC Four HD + BBC News + BBC One Northern Ireland HD + BBC Three + BBC Three HD + BBC Two England + BBC Two Northern Ireland + BBC Two Northern Ireland HD + Blaze + Bloomberg + Bloomberg HD + Boomerang + Boomerang HD + Boomerang +1 + Cartoonito + Cartoon Network + Cartoon Network HD + Cartoon Network +1 + CBBC + CBBC HD + CBeebies + CBeebies HD + CBS Reality + CBS Reality +1 + Challenge + Channel 4 + Channel 4 HD + Channel 4 +1 + CNBC Europe + CNN + CNN HD + Colors Cineplex + Colors + Colors HD + Colors Rishtey + Comedy Central + Comedy Central Extra + Comedy Central HD + Comedy Central +1 + Crime + Investigation + Crime + Investigation HD + Crime + Investigation +1 + Cula4 + Dave + Dave HD + Dave ja vu + Discovery Channel + Discovery Channel HD + Discovery Channel +1 + Discovery History + Discovery History +1 + Discovery Science + Discovery Turbo + Discovery Turbo +1 + DMAX + DMAX +1 + Drama + E! Entertainment + E4 + E4 Extra + E4 HD + E4 +1 + Earthx TV + Eden + Eden +1 + E! Entertainment HD + Euronews + Eurosport 1 + Eurosport 1 HD + Eurosport 2 + Eurosport 2 HD + Fashion TV + Film4 + Film4 HD + Film4 +1 + Food Network + Food Network +1 + Foodxp + France 24 English HD + GB News HD + GEO News + GEO TV + GOLD + GOLD HD + GOLD +1 + GREAT! action + GREAT! action +1 + GREAT! movies + GREAT! movies +1 + GREAT! movies christmas + GREAT! movies christmas +1 + GREAT! tv + GREAT! tv +1 + HGTV + HGTV +1 + HorrorXtra + HorrorXtra +1 + Investigation Discovery + Investigation Discovery +1 + ITV3 + ITV4 + ITVBe + Kerrang! TV + Kiss TV + Legend + LFC TV HD + Magic + More4 + More4 HD + More4 +1 + Christmas 24 + Christmas 24+ + MTV + MTV 80s + MTV 90s + MTV HD + MTV Hits + MTV Music + MUTV + MUTV HD + National Geographic Channel + National Geographic Channel HD + National Geographic Channel +1 + National Geographic WILD + National Geographic WILD HD + NDTV 24x7 + Nickelodeon + Nickelodeon HD + Nickelodeon +1 + Nick Jr. + Nick Jr. HD + Nick Jr. +1 + Oireachtas TV + PBS America + Phoenix CNE Channel HD + Pop + Pop Max + Pop Max +1 + Pop +1 + Quest + Quest HD + Quest +1 + Quest Red + Quest Red +1 + QVC + QVC Style HD + Racing TV + Racing TV HD + RealityXtra + Really + RTE2 + RTE2 +1 + RTE Jr + RTE News + RTE One + RTE One +1 + Sanskar + Sky Arts + Sky Arts HD + Sky Atlantic + Sky Atlantic HD + Sky Atlantic +1 + Sky Cinema Action + Sky Cinema Action HD + Sky Cinema Animation + Sky Cinema Animation HD + Sky Cinema Comedy + Sky Cinema Comedy HD + Sky Cinema Family + Sky Cinema Family HD + Sky Cinema Premiere + Sky Cinema Premiere HD + Sky Cinema Premiere +1 + Sky Cinema Sci-fi/Horror + Sky Cinema Sci-fi/Horror HD + Sky Cinema Thriller + Sky Cinema Thriller HD + Sky Comedy + Sky Comedy HD + Sky Crime + Sky Crime HD + Sky Crime +1 + Sky Documentaries + Sky Documentaries HD + Sky History + Sky History 2 + Sky History 2 HD + Sky History HD + Sky History +1 + Sky Kids HD + Sky Max + Sky Max HD + Sky Mix + Sky Mix HD + Sky Nature + Sky Nature HD + Sky News + Sky News HD + Sky Replay + Sky Sci-Fi + Sky Sci-Fi HD + Sky Showcase + Sky Showcase HD + Sky Showcase +1 + Sky Sports Arena + Sky Sports Arena HD + Sky Sports Box Office + Sky Sports Cricket + Sky Sports Cricket HD + Sky Sports F1 + Sky Sports F1 HD + Sky Sports Football + Sky Sports Football HD + Sky Sports Golf + Sky Sports Golf HD + Sky Sports Main Event + Sky Sports Main Event HD + Sky Sports Mix + Sky Sports Mix HD + Sky Sports News + Sky Sports News HD + Sky Sports NFL + Sky Sports NFL HD + Sky Sports Premier League + Sky Sports Premier League HD + Sky Sports Racing + Sky Sports Racing HD + Sky Witness + Sky Witness HD + Sky Witness +1 + Sony MAX 2 + Sony MAX + Sony MAX HD + Sportystuff TV HD + Talking Pictures TV + Talk TV HD + TG4 + That's 60s + That's 80s + That's 90s + That's Christmas + That's TV + The Box + Tiny Pop + Tiny Pop +1 + TLC + TLC HD + TLC +1 + TNT Sports 1 + TNT Sports 1 HD + TNT Sports 2 + TNT Sports 2 HD + TNT Sports 3 + TNT Sports 3 HD + TNT Sports 4 + TNT Sports 4 HD + Sky Sports Box Office HD + TNT Sports Ultimate + Together TV + Travelxp + TRT World + TRT World HD + TVC News + Utsav Bharat + Utsav Gold + Utsav Gold HD + Utsav Plus + Virgin Media Four + Virgin Media More + Virgin Media One + Virgin Media One +1 + Virgin Media Three + Virgin Media Two + W + W HD + W +1 + Yesterday + Yesterday +1 + Zee Cinema + Zee TV + Zee TV HD + From 9bf9acdd69a4f1a544b796acb4dd2383188b0a3c Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Thu, 23 Nov 2023 14:14:11 +0300 Subject: [PATCH 5/5] Update tvireland.ie.channels.xml --- sites/tvireland.ie/tvireland.ie.channels.xml | 78 ++++++++++---------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/sites/tvireland.ie/tvireland.ie.channels.xml b/sites/tvireland.ie/tvireland.ie.channels.xml index f955860e..90c93729 100644 --- a/sites/tvireland.ie/tvireland.ie.channels.xml +++ b/sites/tvireland.ie/tvireland.ie.channels.xml @@ -1,52 +1,15 @@ - 4Music Alibi Alibi HD Alibi +1 Al Jazeera English HD Animal Planet + Animal Planet HD Animal Planet +1 Arirang HD + Ayozat TV B4U Movies B4U Music Baby TV @@ -55,6 +18,8 @@ BBC Four BBC Four HD BBC News + BBC News (Global) + BBC One BBC One Northern Ireland HD BBC Three BBC Three HD @@ -82,9 +47,11 @@ Channel 4 HD Channel 4 +1 CNBC Europe + CNBC UK HD CNN CNN HD Colors Cineplex + Colors Gujrati Colors Colors HD Colors Rishtey @@ -96,6 +63,7 @@ Crime + Investigation HD Crime + Investigation +1 Cula4 + Cula4 HD Dave Dave HD Dave ja vu @@ -165,6 +133,7 @@ More4 +1 Christmas 24 Christmas 24+ + MTV Ireland MTV MTV 80s MTV 90s @@ -179,12 +148,17 @@ National Geographic WILD National Geographic WILD HD NDTV 24x7 + New Vision + NHK World + NHK World HD Nickelodeon Nickelodeon HD Nickelodeon +1 Nick Jr. Nick Jr. HD Nick Jr. +1 + Nick Jr. Peppa + NickLoudHouse Oireachtas TV PBS America Phoenix CNE Channel HD @@ -192,6 +166,8 @@ Pop Max Pop Max +1 Pop +1 + Premier Sports 1 ROI HD + Premier Sports 2 ROI HD Quest Quest HD Quest +1 @@ -204,10 +180,12 @@ RealityXtra Really RTE2 + RTE2 HD RTE2 +1 RTE Jr RTE News RTE One + RTE One HD RTE One +1 Sanskar Sky Arts @@ -221,13 +199,21 @@ Sky Cinema Animation HD Sky Cinema Comedy Sky Cinema Comedy HD + Sky Cinema Christmas + Sky Cinema Christmas HD Sky Cinema Family Sky Cinema Family HD + Sky Cinema 80s Icons + Sky Cinema 80s Icons HD + Sky Cinema Mockingjay + Sky Cinema Mockingjay HD Sky Cinema Premiere Sky Cinema Premiere HD Sky Cinema Premiere +1 Sky Cinema Sci-fi/Horror Sky Cinema Sci-fi/Horror HD + Sky Cinema Tolkien + Sky Cinema Tolkien HD Sky Cinema Thriller Sky Cinema Thriller HD Sky Comedy @@ -270,6 +256,7 @@ Sky Sports Golf HD Sky Sports Main Event Sky Sports Main Event HD + Sky Sports Main Event Ultra HDR Sky Sports Mix Sky Sports Mix HD Sky Sports News @@ -278,18 +265,25 @@ Sky Sports NFL HD Sky Sports Premier League Sky Sports Premier League HD + Sky Sports Premier League ROI + Sky Sports Premier League ROI HD Sky Sports Racing Sky Sports Racing HD Sky Witness Sky Witness HD Sky Witness +1 + Sony Entertainment TV Asia + Sony Entertainment TV Asia HD Sony MAX 2 Sony MAX Sony MAX HD + Sony SAB Sportystuff TV HD Talking Pictures TV Talk TV HD TG4 + TG4 HD + TG4 +1 That's 60s That's 80s That's 90s @@ -310,6 +304,7 @@ TNT Sports 4 TNT Sports 4 HD Sky Sports Box Office HD + TNT Sports Box Office HD TNT Sports Ultimate Together TV Travelxp @@ -320,12 +315,17 @@ Utsav Gold Utsav Gold HD Utsav Plus + Utsav Plus HD Virgin Media Four + Virgin Media Four HD Virgin Media More Virgin Media One + Virgin Media One HD Virgin Media One +1 Virgin Media Three + Virgin Media Three HD Virgin Media Two + Virgin Media Two HD W W HD W +1