diff --git a/sites/ontvtonight.com.channels.xml b/sites/ontvtonight.com.channels.xml index 150e832e..78dfb0fc 100755 --- a/sites/ontvtonight.com.channels.xml +++ b/sites/ontvtonight.com.channels.xml @@ -1,125 +1,126 @@ - 10 Bold + Outdoor Channel + MavTV + DW English + God TV UK + Sky News Arabia + BBC Arabic + Seven + 7 Two + 7 mate + 9 Go! 10 Peach - 4Music - 4Seven - 5 Select + ABC TV + ABC News + SBS World Movies + 10 Bold + NITV + 9 Life + 7 flix + Racing.com + Australian Christian Channel + TG 4 + RTÉ News + Oireachtas TV 5 Star 5 USA - 7 flix - 7 mate - 7 Two - 9 Go! - 9 Life - 92 News - ABC News - ABC TV - Ahlulbayt TV - Akaal Channel UK Aljazeera English - BBC Arabic - BBC Four - BBC News - BBC One + Sky Arts UK BBC One London BBC One Scotland - BBC Parliament - BBC Red Button 1 + BBC News BBC Two - Blaze UK - Box Hits - Brit Asia TV - CBBC + BBC Red Button 1 + BBC Four CBeebies UK - CBS Drama UK - CBS Justice UK - CBS Reality UK - Challenge UK + BBC Parliament + CBBC Channel 5 - Channel 5 +1 CITV - Court TV UK - Create and Craft - Cruise 1st TV - Dave ja vu + Together TV Dave UK - DMAX UK - Drama UK - Drama UK +1 - DW English - E4 UK - E4 UK +1 - Eman Channel - Film 4 UK - Film 4 UK +1 - Food Network UK - Forces TV - FreeSports - Gems TV - God TV UK - HGTV UK - Horror Channel UK - Ideal Extra - Ideal World - ITV 2 - ITV 2 +1 - ITV 3 - ITV 3 +1 - ITV 4 - ITV 4 +1 - ITV Be - ITV London - Jewellery Maker - Kanshi TV - KTO - London Live - MavTV - More 4 UK - NITV - Now 80's - Oireachtas TV - Outdoor Channel - Paramount Network UK - PBS America - Pick UK - Pop - Quest Red UK - Quest Red UK +1 Quest UK - Quest UK +1 - QVC Beauty - QVC Style UK + E4 UK +1 + E4 UK + Film 4 UK +1 + Challenge UK + Film 4 UK + 4Music + ITV 2 +1 + Ideal World + ITV London + ITV 2 + ITV 3 + ITV 4 + KTO + More 4 UK QVC UK - Racing TV - Racing.com - Really UK - RT News RT UK - RTÉ News + Sky One UK + Pick UK + The Box UK + Yesterday + HGTV UK + Really UK + BBC One + Food Network UK + Gems TV + Create and Craft + Horror Channel UK + Pop + Racing TV + Tiny Pop + ITV 3 +1 + ITV 4 +1 + Sony Movies Classic + Ahlulbayt TV + CBS Justice UK + CBS Drama UK + Sony Movies Action + Sony Channel UK + Quest UK +1 + Yesterday +1 + Brit Asia TV + Ideal Extra + QVC Beauty Sangat TV SBN International - SBS World Movies - Seven - Sky Arts UK - Sky News Arabia - Sky One UK - Smithsonian Channel UK - Sony Channel UK - Sony Movies Action - Sony Movies Classic + PBS America + Channel 5 +1 + Dave ja vu + 4Seven Sony Movies UK Sony Movies UK +1 - Spotlight TV + RT News + QVC Style UK + Drama UK + Akaal Channel UK + Now 80's + DMAX UK + 5 Select + London Live + Forces TV + ITV Be + Eman Channel Talking Pictures TV - TBN UK - TG 4 - The Box UK - Tiny Pop TJC - Together TV - Yesterday - Yesterday +1 + CBS Reality UK + Box Hits + Blaze UK + Jewellery Maker + Quest Red UK + Quest Red UK +1 + Kanshi TV + FreeSports + 92 News + Paramount Network UK + Smithsonian Channel UK + Spotlight TV + TBN UK + Drama UK +1 + Cruise 1st TV + Court TV UK \ No newline at end of file diff --git a/sites/ontvtonight.com.config.js b/sites/ontvtonight.com.config.js index 07f10f08..eb8e1482 100644 --- a/sites/ontvtonight.com.config.js +++ b/sites/ontvtonight.com.config.js @@ -9,20 +9,25 @@ dayjs.extend(utc) dayjs.extend(timezone) dayjs.extend(customParseFormat) +const tz = { + au: 'Australia/Sydney', + ie: 'Europe/Dublin', + uk: 'Europe/London' +} + module.exports = { lang: 'en', + days: 3, site: 'ontvtonight.com', channels: 'ontvtonight.com.channels.xml', output: '.gh-pages/guides/ontvtonight.com.guide.xml', url: function ({ date, channel }) { const [region, id] = channel.site_id.split('#') - return region - ? `https://www.ontvtonight.com/${region}/guide/listings/channel/${id}.html?dt=${date.format( - 'YYYY-MM-DD' - )}` - : `https://www.ontvtonight.com/guide/listings/channel/${id}.html?dt=${date.format( - 'YYYY-MM-DD' - )}` + let url = `https://www.ontvtonight.com` + if (region) url += `/${region}` + url += `/guide/listings/channel/${id}.html?dt=${date.format('YYYY-MM-DD')}` + + return url }, logo: function ({ content }) { const dom = new JSDOM(content) @@ -32,13 +37,13 @@ module.exports = { return img ? img.src : null }, - parser: function ({ content, date }) { + parser: function ({ content, date, channel }) { const programs = [] const items = parseItems(content) items.forEach(item => { const title = parseTitle(item) - const start = parseStart(item, date) - const stop = parseStop(item, date) + const start = parseStart(item, date, channel) + const stop = start.add(1, 'h') if (title && start) { if (programs.length) { @@ -57,15 +62,14 @@ module.exports = { } } -function parseStop(item, date) { - return date.tz('Europe/London').endOf('d') -} +function parseStart(item, date, channel) { + const [region, id] = channel.site_id.split('#') + const timezone = region ? tz[region] : tz['uk'] -function parseStart(item, date) { let time = (item.querySelector('td:nth-child(1) > h5') || { textContent: '' }).textContent.trim() time = `${date.format('DD/MM/YYYY')} ${time.toUpperCase()}` - return dayjs.tz(time, 'DD/MM/YYYY H:mm A', 'Europe/London') + return dayjs.tz(time, 'DD/MM/YYYY H:mm A', timezone) } function parseTitle(item) {