From 2dafd225066108dea2ff8c89862fad4f92d0776d Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Sun, 26 Nov 2023 11:27:13 +0300 Subject: [PATCH] Update ontvtonight.com --- .../ontvtonight.com/ontvtonight.com.config.js | 121 +- sites/ontvtonight.com/ontvtonight.com.test.js | 6 +- .../ontvtonight.com_au.channels.xml | 1729 +++++++++++++- .../ontvtonight.com_ca.channels.xml | 1482 ++++++++++++ .../ontvtonight.com_ie.channels.xml | 6 - .../ontvtonight.com_uk.channels.xml | 101 - .../ontvtonight.com_us.channels.xml | 2075 ++++++++++++++++- 7 files changed, 5312 insertions(+), 208 deletions(-) create mode 100644 sites/ontvtonight.com/ontvtonight.com_ca.channels.xml delete mode 100644 sites/ontvtonight.com/ontvtonight.com_ie.channels.xml delete mode 100644 sites/ontvtonight.com/ontvtonight.com_uk.channels.xml diff --git a/sites/ontvtonight.com/ontvtonight.com.config.js b/sites/ontvtonight.com/ontvtonight.com.config.js index fbe4b74e..009dee55 100644 --- a/sites/ontvtonight.com/ontvtonight.com.config.js +++ b/sites/ontvtonight.com/ontvtonight.com.config.js @@ -8,20 +8,13 @@ dayjs.extend(utc) dayjs.extend(timezone) dayjs.extend(customParseFormat) -const tz = { - au: 'Australia/Sydney', - ie: 'Europe/Dublin', - uk: 'Europe/London', - us: 'America/New_York' -} - module.exports = { site: 'ontvtonight.com', days: 2, url: function ({ date, channel }) { const [region, id] = channel.site_id.split('#') let url = 'https://www.ontvtonight.com' - if (region) url += `/${region}` + if (region && region !== 'us') url += `/${region}` url += `/guide/listings/channel/${id}.html?dt=${date.format('YYYY-MM-DD')}` return url @@ -50,16 +43,124 @@ module.exports = { }) return programs + }, + async channels({ country }) { + const axios = require('axios') + const _ = require('lodash') + + const providers = { + au: ['o', 'a'], + ca: [ + 'Y464014423', + '-464014503', + '-464014594', + '-464014738', + 'X3153330286', + 'X464014503', + 'X464013696', + 'X464014594', + 'X464014738', + 'X464014470', + 'X464013514', + 'X1210684931', + 'T3153330286', + 'T464014503', + 'T1810267316', + 'T1210684931' + ], + us: [ + 'Y341768590', + 'Y1693286984', + 'Y8833268284', + '-341767428', + '-341769166', + '-341769884', + '-3679985536', + '-341766967', + 'X4100694897', + 'X341767428', + 'X341768182', + 'X341767434', + 'X341768272', + 'X341769884', + 'X3679985536', + 'X3679984937', + 'X341764975', + 'X3679985052', + 'X341766967', + 'K4805071612', + 'K5039655414' + ] + } + const regions = { + au: [ + 1, 2, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 17, 18, 29, 28, 27, 26, 25, 23, 22, + 21, 20, 19, 24, 30, 31, 32, 33, 34, 35, 36, 39, 38, 37, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53 + ], + ca: [null], + us: [null] + } + const zipcodes = { + au: [null], + ca: ['M5G1P5', 'H3B1X8', 'V6Z2H7', 'T2P3E6', 'T5J2Z2', 'K1P1B1'], + us: [10199, 90052, 60607, 77201, 85026, 19104, 78284, 92199, 75260] + } + + const channels = [] + for (let provider of providers[country]) { + for (let zipcode of zipcodes[country]) { + for (let region of regions[country]) { + let url = 'https://www.ontvtonight.com' + if (country === 'us') url += '/guide/schedule' + else url += `/${country}/guide/schedule` + const data = await axios + .post(url, null, { + params: { + provider, + region, + zipcode, + TVperiod: 'Night', + date: dayjs().format('YYYY-MM-DD'), + st: 0, + is_mobile: 1 + } + }) + .then(r => r.data) + .catch(console.log) + + const $ = cheerio.load(data) + $('.channelname').each((i, el) => { + let name = $(el).find('center > a:eq(1)').text() + name = name.replace(/\-\-/gi, '-') + const url = $(el).find('center > a:eq(1)').attr('href') + const [, number, slug] = url.match(/\/(\d+)\/(.*)\.html$/) + + channels.push({ + lang: 'en', + name, + site_id: `${country}#${number}/${slug}` + }) + }) + } + } + } + + return _.uniqBy(channels, 'site_id') } } function parseStart($item, date, channel) { + const timezones = { + au: 'Australia/Sydney', + ca: 'America/Toronto', + us: 'America/New_York' + } const [region] = channel.site_id.split('#') - const timezone = region ? tz[region] : tz['uk'] const timeString = $item('td:nth-child(1) > h5').text().trim() const dateString = `${date.format('YYYY-MM-DD')} ${timeString}` - return dayjs.tz(dateString, 'YYYY-MM-DD H:mm a', timezone) + return dayjs.tz(dateString, 'YYYY-MM-DD H:mm a', timezones[region]) } function parseTitle($item) { diff --git a/sites/ontvtonight.com/ontvtonight.com.test.js b/sites/ontvtonight.com/ontvtonight.com.test.js index ba9ef33e..31fde48e 100644 --- a/sites/ontvtonight.com/ontvtonight.com.test.js +++ b/sites/ontvtonight.com/ontvtonight.com.test.js @@ -1,5 +1,7 @@ -// npm run grab -- --site=ontvtonight.com -// npm run grab -- --site=ontvtonight.com +// npm run channels:parse -- --config=./sites/ontvtonight.com/ontvtonight.com.config.js --output=./sites/ontvtonight.com/ontvtonight.com_au.channels.xml --set=country:au +// npm run channels:parse -- --config=./sites/ontvtonight.com/ontvtonight.com.config.js --output=./sites/ontvtonight.com/ontvtonight.com_ca.channels.xml --set=country:ca +// npm run channels:parse -- --config=./sites/ontvtonight.com/ontvtonight.com.config.js --output=./sites/ontvtonight.com/ontvtonight.com_us.channels.xml --set=country:us +// npm run grab -- --channels=./sites/ontvtonight.com/ontvtonight.com_ca.channels.xml const { parser, url } = require('./ontvtonight.com.config.js') const dayjs = require('dayjs') diff --git a/sites/ontvtonight.com/ontvtonight.com_au.channels.xml b/sites/ontvtonight.com/ontvtonight.com_au.channels.xml index d9aaa0c2..a543f080 100644 --- a/sites/ontvtonight.com/ontvtonight.com_au.channels.xml +++ b/sites/ontvtonight.com/ontvtonight.com_au.channels.xml @@ -1,53 +1,1676 @@ - - - 10 Bold - 10 Peach - 10 Shake - 7 flix - 7 mate - 7 Two - 9 Gem - 9 Go! - 9 Life - 9 Rush - ABC Kids / ABC TV Plus - ABC ME - ABC News - ABC TV - A&E Australia - Ten - Seven - Nine - ESPN Australia - Fox 8 - Fox Arena - Fox Classics - Fox Comedy - Fox Crime - Fox Docos - Fox Funny - Fox News - Fox One - Fox SciFi - Fox Showcase - Fox Sleuth - Foxtel Movies Action - Foxtel Movies Comedy - Foxtel Movies Drama - Foxtel Movies Family - Foxtel Movies Greats - Foxtel Movies Kids - Foxtel Movies Premiere - Foxtel Movies Romance - Foxtel Movies Thriller - Foxtel Movies Ultra HD - NITV - PBS Kids - Racing.com - SBS One - SBS Food - SBS World Movies - SBS WorldWatch - Sky News Regional - SpreeTV - + + + + 7flix + 7mate + 7TWO + GEM + GO + 9Life + 9Rush + 10 Bold + 10 Peach + 10 HD + ABC NEWS + ABC Kids / ABC TV Plus + ABC ME + ABC TV HD + 7 HD + 9 HD + NITV + RACING.COM + SBS Food + SBS One + SBS World Movies + SBS WorldWatch + diff --git a/sites/ontvtonight.com/ontvtonight.com_ca.channels.xml b/sites/ontvtonight.com/ontvtonight.com_ca.channels.xml new file mode 100644 index 00000000..9ad2f4d4 --- /dev/null +++ b/sites/ontvtonight.com/ontvtonight.com_ca.channels.xml @@ -0,0 +1,1482 @@ + + + + AAJ TAK + ABP News + Abu Dhabi TV + ADDIK + Adult Swim + Al Jazeera English + ATN Cricket Plus Channel + ATN Jaya + ATN Life + ATN News + ATN PM ONE + ATN Punjabi 5 + ATN Punjabi + B4U Music + BBC Earth + BBC World News + CASA + CBC Fredericton + CBC News Network HDTV + CBET Windsor + CBFT - ICI Radio-Canada + CBHT + CBKFT ICI Radio-Canada (Regina) + CBC Saskatchewan + CBC Toronto HDTV + CBOT HDTV + CBC Calgary HDTV + CBS Sports Network (Canada) + CBUFT ICI Radio-Canada (Vancouver) + CBC Vancouver + CBC Manitoba + CBXFT ICI Radio-Canada (Edmonton) + CBC Edmonton + CCTV Entertainment + CTV Montreal + CFCM TVA (Quebec) + CTV Calgary + CFEM TVA (Rouyn-Noranda) + CFJC Kamloops TV + Noovo Sherbrooke HDTV + CTV Edmonton + Noovo Saguenay HDTV + Global Saskatoon + Noovo Rivière-du-Loup HD + Noovo Rivière-du-Loup SD + CTV Toronto + CFVS V (Val-d'Or) + CHAT + CHCH HDTV + CHEK + CHEX CTV Global Peterborough + Global Thunder Bay HDTV + Citytv Winnipeg + CHOT TVA (Gatineau) + TVOntario + CTV Yorkton HDTV + Global Calgary HDTV + CIMT TVA (Rivière-du-Loup) + Cinépop + CTV Prince Albert HDTV + Global Lethbridge HDTV + CITL + Global Edmonton + Citytv Toronto + Citytv Saskatchewan + CJBR ICI Radio-Canada (Rimouski) + CJPM TVA (Saguenay) + Citytv Calgary + CTV Atlantic (Moncton, NS) + Citytv Edmonton HDTV + CKPG + CKPR HDTV + Citytv Vancouver HDTV + CTV Winnipeg HDTV + Crime + Investigation + CTV DRAMA Channel SD + CTV SCI-FI Channel SD + Current Time TV SD + DejaView TV + Discovery Velocity HDTV + Évasion HDTV + Filipino TV + GameTV + GEO TV (Canada) + Super Channel GINX eSports TV (Canada) + GMA Life TV + HPItv + HPItv International + HPItv West + Jewish Life TV + KCPQ HDTV + KOMO HDTV + KSPS HDTV + KTLA HDTV + La chaîne Disney + Love Nature + Makeful + MovieTime + MTV2 + MTV India + Much + NBA TV Canada + NDTV 24x7 + NFL RedZone HDTV + Nickelodeon Canada + Noovo Quebec + Prise 2 + PTC Punjabi + RDS Info + RTR Planeta + Sahara One + Salt + Light Television + Séries+ HDTV + Silver Screen Classics + Slice TV + Sportsman Channel (Canada) + Sportsnet One + Rogers Sportsnet Ontario HDTV + Rogers Sportsnet Pacific HDTV + Star Chinese Channel + Stingray Baroque + Stingray Eclectic Electronic + Stingray Le Palmarès + Stingray LOUD + Stingray Nature + Stingray RETRO + Stingray VIBE + Super Channel Vault + Super Ecran 2 HDTV + Tamil Vision + Turner Classic Movies (Canada) + Telehit Música US + Télémagino + TELILE + TGCOM 24 + The Family Channel (East) + Treehouse TV + TV5 Québec Canada HDTV + TVP Info + WBZ HDTV + WCGtv + WDIV HDTV + WFXT HDTV + WGBH HDTV + WGRZ HDTV + WGRZ Antenna TV + WHDH HDTV + WHEC HDTV + WHEC MeTV + WIVB HDTV + WKBW HDTV + WKBW Bounce TV + WNED PBS HDTV + W Network (East) + W Network (West) + WNLO HDTV + WNYB TCT HDTV + WNYO HDTV + WPIX HDTV + WPXJ Grit + WROC HDTV + WSBK HDTV + WTVS HDTV + WUHF HDTV + WUTV HDTV + WUTV TBD + WWJ HDTV + WXXI HDTV + WXXI World + WXXI Create + WXXI PBS Kids + Yoopa + YTV (East) + Zeste + diff --git a/sites/ontvtonight.com/ontvtonight.com_ie.channels.xml b/sites/ontvtonight.com/ontvtonight.com_ie.channels.xml deleted file mode 100644 index 10b695ea..00000000 --- a/sites/ontvtonight.com/ontvtonight.com_ie.channels.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - Oireachtas TV - RTÉ News - TG 4 - \ No newline at end of file diff --git a/sites/ontvtonight.com/ontvtonight.com_uk.channels.xml b/sites/ontvtonight.com/ontvtonight.com_uk.channels.xml deleted file mode 100644 index b05c040e..00000000 --- a/sites/ontvtonight.com/ontvtonight.com_uk.channels.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - - 4Seven - 5 Action - 5 Select - 5 Star - 5 USA - 92 News - Ahlulbayt TV - Akaal Channel UK - Aljazeera English - BBC Four - BBC News - BBC One - BBC One London - BBC One Scotland - BBC Parliament - BBC Red Button 1 - BBC Two - Blaze UK - Box Hits - Brit Asia TV - CBBC - CBeebies UK - CBS Drama UK - CBS Justice UK - CBS Reality UK - Challenge UK - Challenge +1 UK - Channel 5 - Channel 5 +1 - CITV - Create and Craft - Cruise 1st TV - Dave UK - Dave ja vu - DMAX UK - Drama UK - Drama UK +1 - E4 UK - E4 Extra - E4 UK +1 - Eman Channel - Film 4 UK - Film 4 UK +1 - Food Network UK - Gems TV - Great! Movies - Great! Movies Action - Great! Movies Classic - Great! Movies Classic +1 - Great! TV - Great! TV +1 - HGTV UK - Ideal World - ITV London - ITV 2 - ITV 2 +1 - ITV 3 - ITV 3 +1 - ITV 4 - ITV 4 +1 - ITV Be - Jewellery Maker - Kanshi TV - KTO - Horror Channel UK - London Live - More 4 UK - Now 80's - PBS America - Pick UK - Pop - Quest Red UK - Quest Red UK +1 - Quest UK - Quest UK +1 - QVC Beauty - QVC Style UK - QVC UK - Racing TV - Really UK - RT News - RT UK - Sangat TV - SBN International - Sky Arts UK - Sky Max UK - Smithsonian Channel UK - Spotlight TV - Talking Pictures TV - TBN UK - The Box UK - Tiny Pop - TJC - Together TV - ViaplayXtra - Yesterday - Yesterday +1 - diff --git a/sites/ontvtonight.com/ontvtonight.com_us.channels.xml b/sites/ontvtonight.com/ontvtonight.com_us.channels.xml index f8e656e9..f8b7ab62 100644 --- a/sites/ontvtonight.com/ontvtonight.com_us.channels.xml +++ b/sites/ontvtonight.com/ontvtonight.com_us.channels.xml @@ -1,39 +1,2042 @@ - ABC East - ACC Network - ActionMAX (East) - AMC (East) - Animal Planet (East) - BBC America (East) - beIN Sports (English) - BET Her West - BET Jams - BET Soul - Big Ten Network (National) - Cheddar News - Investigation Discovery West - K16IW CMC-USA - K16IW CMC-TV - Sports News Highlights (KDNU-LD5) Las Vegas, NV - MeTV (KITV-DT2) Honolulu, HI - Hawaii TV (KITV-DT3) Honolulu, HI - MeTV (KREG-TV) Glenwood Springs, CO - KYAZ MeTV+ - Lifetime Movies West - Lifetime West - MSG WNY - News12 Bronx - News12 Brooklyn - News 12 Hudson Valley - News12 New Jersey - News12 Westchester - TBS Superstation (East) - truTV HDTV (West) - CBS (WCBS) - De Película Clásico - De Película - De Película EUA (USA) - XEWT 12 BC - XHBC Tu Canal HDTV + + ABC + ACC Network + ActionMAX (East) + AMC (East) + Animal Planet (East) + BBC America (East) + beIN Sports (English) + BET Jams + BET Soul + Big Ten Network (National) + TBS Superstation (East) + WCBS + De Película Clásico + De Película