diff --git a/.github/workflows/tvhebdo.com.yml b/.github/workflows/tvhebdo.com.yml new file mode 100644 index 00000000..540c4672 --- /dev/null +++ b/.github/workflows/tvhebdo.com.yml @@ -0,0 +1,17 @@ +name: tvhebdo.com +on: + schedule: + - cron: '0 0 * * *' + workflow_dispatch: + workflow_run: + workflows: [_trigger] + types: + - completed +jobs: + load: + uses: ./.github/workflows/_load.yml + with: + site: ${{github.workflow}} + secrets: + APP_ID: ${{ secrets.APP_ID }} + APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }} diff --git a/sites/tvhebdo.com/__data__/content.html b/sites/tvhebdo.com/__data__/content.html new file mode 100644 index 00000000..3f65ce8a --- /dev/null +++ b/sites/tvhebdo.com/__data__/content.html @@ -0,0 +1,1738 @@ + + + + + + TV Hebdo.com + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+ + + + + +
+
+ +
+
+ +
+
+ +
+
+ + +
+ + + + + + + + + + + +
+ +
+
+ + + +
+ +
+ +

Filtres

+ + + + + + + + + + + + +
+ Primeur

+ HD +
+ + + + +
+
+ + +
+ +
+
+ LÉGENDE +      Primeur : primeur +      HD : HD +      ajouter à mes favoris : mes favoris +
+ + + +
+ Taille du texte de la grille horaire | +   + +
+ +
+
+ + + + + + + +
+
+
+ + + mercredi 11 mai 2022 +   Jour suivant + +
+ +
 
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
HeureICI Radio-Canada Télé (CBFT) - Programmation complète - Voir le site de la chaîneMes
favoris
Mes
alertes courriel
11:305 chefs dans ma cuisine + + + + + + + + + + + + +
12:00Le téléjournal midi + + + + + + + + + + + + +
12:30Question de jugement + + + + + + + + + + + + +
13:00Bonsoir bonsoir! + + + + + + + + + + + + +
14:00Un mariage de rêve + + + + + + + + +
16:00On va se le dire + + + + + + + + + + + + +
17:29Silence, on joue! + + + + + + + + + + + + +
17:59Le téléjournal avec Patrice Roy + + + + + + + + + + + + +
19:00Question de jugement + + + + + + + + + + + + +
19:30L'épicerie + + + + + + + + + + + + +
20:00Dans l'oeil du dragon + + + + + + + + + + + + +
21:00Bonsoir bonsoir! + + + + + + + + + + + + +
22:00Le téléjournal + + + + + + + + + + + + +
23:00Sports express + + + + + + + + + + + + +
23:05ADISQ - Écoute mon album + + + + + + + + + + + + +
23:07Sous influence + + + + + + + + + + + + +
00:09Outlander: Le chardon et le tartan + + + + + + + + + + + + +
01:19Mordus de politique + + + + + + + + + + + + +
02:4924·60 + + + + + + + + + + + + +
03:49Hors d'ondes + + + + + + + + + + + + +
05:00Boule et Bill 3D + + + + + + + + + + + + +
05:15Boule et Bill 3D + + + + + + + + + + + + +
05:30Les Schtroumpfs + + + + + + + + + + + + +
06:00Romy & Boo + + + + + + + + + + + + +
06:15Les cosmo-joueurs + + + + + + + + + + + + +
06:22Les cosmo-joueurs + + + + + + + + + + + + +
06:30Ranger Rob + + + + + + + + + + + + +
06:45Dino Ranch + + + + + + + + + + + + +
07:00Sonic Boom + + + + + + + + + + + + +
07:15Garfield & Cie + + + + + + + + + + + + +
07:30Agent Binky: protecteur de l'univers + + + + + + + + + + + + +
07:45Esme & Roy + + + + + + + + + + + + +
08:00Tom Sawyer + + + + + + + + + + + + +
08:30Belle et Sébastien + + + + + + + + + + + + +
08:45Belle et Sébastien + + + + + + + + + + + + +
09:00La cage aux folles II + + + + + + + + +
11:00Ricardo + + + + + + + + + + + + +
+ + + +
+ + +
+ +
+ + +
+
+ + +
+ +
+ + + + + +
+ + + + + + diff --git a/sites/tvhebdo.com/__data__/no_content.html b/sites/tvhebdo.com/__data__/no_content.html new file mode 100644 index 00000000..ef6ada55 --- /dev/null +++ b/sites/tvhebdo.com/__data__/no_content.html @@ -0,0 +1,981 @@ + + + + + + TV Hebdo.com + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+ + + + + +
+
+ +
+
+ +
+
+ +
+
+ + +
+ + + + + + + + + + + +
+ +
+
+ + + +
+ +
+ +

Filtres

+ + + + + + + + + + + + +
+ Primeur

+ HD +
+ + + + +
+
+ + +
+ +
+
+ LÉGENDE +      Primeur : primeur +      HD : HD +      ajouter à mes favoris : mes favoris +
+ + + +
+ Taille du texte de la grille horaire | +   + +
+ +
+
+ + + + + + + +
+
+
+ + Jour précédent   + + vendredi 19 mai 2023 + +
+ +
 
+
+
+ + + + + + + +
HeureICI Radio-Canada Télé (CBFT) - Programmation complète - Voir le site de la chaîneMes
favoris
Mes
alertes courriel
+ + + +
+ + +
+ +
+ + +
+
+ + +
+ +
+ + + + + +
+ + + + + + diff --git a/sites/tvhebdo.com/tvhebdo.com.config.js b/sites/tvhebdo.com/tvhebdo.com.config.js new file mode 100644 index 00000000..f29d54af --- /dev/null +++ b/sites/tvhebdo.com/tvhebdo.com.config.js @@ -0,0 +1,98 @@ +const cheerio = require('cheerio') +const axios = require('axios') +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: 'tvhebdo.com', + url: function ({ channel, date }) { + return `https://www.tvhebdo.com/horaire-tele/${channel.site_id}/date/${date.format( + 'YYYY-MM-DD' + )}` + }, + parser: function ({ content, date }) { + let programs = [] + const items = parseItems(content) + items.forEach(item => { + const prev = programs[programs.length - 1] + const $item = cheerio.load(item) + let start = parseStart($item, date) + if (prev) { + if (start.isBefore(prev.start)) { + start = start.add(1, 'd') + } + prev.stop = start + } + let stop = start.add(30, 'm') + programs.push({ + title: parseTitle($item), + start, + stop + }) + }) + + return programs + }, + async channels() { + let items = [] + const offsets = [ + 0, 20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 300, 320, 340, 360 + ] + for (let offset of offsets) { + const url = `https://www.tvhebdo.com/horaire/gr/offset/${offset}/gr_id/0/date/2022-05-11/time/12:00:00` + console.log(url) + const html = await axios + .get(url, { + headers: { + Cookie: + 'distributeur=8004264; __utmz=222163677.1652094266.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); _gcl_au=1.1.656635701.1652094273; tvh=3c2kaml9u14m83v91bg4dqgaf3; __utmc=222163677; IR_gbd=tvhebdo.com; IR_MPI=cf76b363-cf87-11ec-93f5-13daf79f8f76%7C1652367602625; __utma=222163677.2064368965.1652094266.1652281202.1652281479.3; __utmt=1; IR_MPS=1652284935955%7C1652284314367; _uetsid=0d8e2e60d13b11ec850db551304ae9e7; _uetvid=80456fa0b26e11ec9bf94951ce79b5f8; __utmb=222163677.19.9.1652284953979; __atuvc=30%7C19; __atuvs=627bdb98682bc242006' + } + }) + .then(r => r.data) + .catch(console.error) + const $ = cheerio.load(html) + const rows = $('table.gr_row').toArray() + items = items.concat(rows) + } + + console.log(`Found ${items.length} channels`) + + return items.map(item => { + const $item = cheerio.load(item) + const name = $item('.gr_row_head > div > a.gr_row_head_logo.link_to_station > img').attr( + 'alt' + ) + const url = $item('.gr_row_head > div > div.gr_row_head_poste > a').attr('href') + const [_, site_id] = url.match(/horaire-tele\/(.*)/) || [null, null] + return { + lang: 'fr', + site_id, + name + } + }) + } +} + +function parseTitle($item) { + return $item('.titre').first().text().trim() +} + +function parseStart($item, date) { + const time = $item('.heure').text() + + return dayjs.tz(`${date.format('YYYY-MM-DD')} ${time}`, 'YYYY-MM-DD HH:mm', 'America/Toronto') +} + +function parseItems(content) { + const $ = cheerio.load(content) + + return $( + '#main_container > div.liste_container > table > tbody > tr[class^=liste_row_style_]' + ).toArray() +} diff --git a/sites/tvhebdo.com/tvhebdo.com.test.js b/sites/tvhebdo.com/tvhebdo.com.test.js new file mode 100644 index 00000000..50c90417 --- /dev/null +++ b/sites/tvhebdo.com/tvhebdo.com.test.js @@ -0,0 +1,56 @@ +// npm run channels:parse -- --config=./sites/tvhebdo.com/tvhebdo.com.config.js --output=./sites/tvhebdo.com/tvhebdo.com_ca.channels.xml +// npx epg-grabber --config=sites/tvhebdo.com/tvhebdo.com.config.js --channels=sites/tvhebdo.com/tvhebdo.com_ca.channels.xml --output=guide.xml --timeout=30000 --days=2 + +const { parser, url } = require('./tvhebdo.com.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('2022-05-11', 'YYYY-MM-DD').startOf('d') +const channel = { + site_id: 'src/CBFT', + xmltv_id: 'CBFT.ca' +} + +it('can generate valid url', () => { + expect(url({ channel, date })).toBe( + 'https://www.tvhebdo.com/horaire-tele/src/CBFT/date/2022-05-11' + ) +}) + +it('can parse response', () => { + const content = fs.readFileSync(path.resolve('sites/tvhebdo.com/__data__/content.html')) + const results = parser({ content, date }).map(p => { + p.start = p.start.toJSON() + p.stop = p.stop.toJSON() + return p + }) + + expect(results[0]).toMatchObject({ + start: '2022-05-11T15:30:00.000Z', + stop: '2022-05-11T16:00:00.000Z', + title: '5 chefs dans ma cuisine' + }) + + expect(results[16]).toMatchObject({ + start: '2022-05-12T04:09:00.000Z', + stop: '2022-05-12T05:19:00.000Z', + title: 'Outlander: Le chardon et le tartan' + }) + + expect(results[36]).toMatchObject({ + start: '2022-05-12T15:00:00.000Z', + stop: '2022-05-12T15:30:00.000Z', + title: 'Ricardo' + }) +}) + +it('can handle empty guide', () => { + const content = fs.readFileSync(path.resolve('sites/tvhebdo.com/__data__/no_content.html')) + const result = parser({ content, date }) + expect(result).toMatchObject([]) +}) diff --git a/sites/tvhebdo.com/tvhebdo.com_ca.channels.xml b/sites/tvhebdo.com/tvhebdo.com_ca.channels.xml new file mode 100644 index 00000000..8b08949d --- /dev/null +++ b/sites/tvhebdo.com/tvhebdo.com_ca.channels.xml @@ -0,0 +1,360 @@ + + + + CPAC English + 2M + SPARK + ABC Sparks HD + addikTV + addik TV HD + Adult Swim SD + Adult Swim HD + A&E + A&E HD + ALJAZEERA + ALPHA + American Hero Channel + AMI-Télé + The Accessible Channel + Animal Planet + Animal Planet HD + Aboriginal Peoples Television Network + APTN HD + Art America + Assemblée Nationale + ASIAN TELEVISION NETWORK + AZ Mundo + BBC Earth + BBC World + Be In Sports + BeIN Sports ESP SD + BeIN Sports ESP HD + BLACK ENTERTAINMENT + BNN Bloomberg + BNN Bloomberg HD + D + D HD + Canal Vie + Canal Vie HD + Caracol TV + Cartoon Network SD + Cartoon Network HD + CASA + CASA HD + CBC News Network + CBC News Network HD + CBFT + CBVU-TV + CBUFT + CBUT-2 + CCT3 + CCTV + CFCF + Omni 1 + CFTM + Savm + CHAN + CICA + CIII (Hull-Ottawa) HD + Cine Latino + Ciné-pop + Ciné-pop HD + CITY + CIVM + CIVT + CJNT (Metro 14) + CJON + CKMI (Montréal) + Classica + COUNTRY MUSIC TELEVISION + CNBC + CNN HD + CNN + Cooking Channel SD + Cooking Channel HD + Cottage Life + CPAC + Crave 1 + Crave 1 HD + Crave 2 + Crave 2 HD + Crave 3 + Crave 3 HD + Crave 4 + Crave 4 HD + Crime + Investigation + CTV Comedy SD + CTV Comedy HD + CTV Drama SD + CTV Drama HD + CTV LIFE SD + CTV LIFE HD + CTVN + CTV SCIFI SD + CTV SCIFI HD + Déjà View + TDC + Discovery HD + Discovery Science + Discovery Science HD + Discovery Velocity + Disney Channel + Disney Channel HD + Disney Jr SD + Disney Jr HD + Disney XD SD + Disney XD HD + Documentary Channel + DTOUR + Deutsche Welle + STAR! + Elle Fictions SD + Elle Fictions HD + ERT World OTN2 + ESPN classics + Euronews + Évasion + Évasion HD + EWTN + FAIR + FAMILY + THE FAMILY CHANNEL HD + Family Jr SD + Family Jr HD + Fight Network + Fight Network HD + FOOD + FOOD HD + FOX Newsworld + FOX Newsworld HD + FOX Sports Racing + FOX Sports Racing + Festival Portuguese Television + France 24 + Frissons TV + FX Canada + FX Canada HD + FXX SD + GAME SHOW NETWORK + GAME TV + Super Channel 4 + Super Channel 4 HD + GOLF + GOLF HD + Haïti HD + HBO + HBO HD + HGTV + HGTV HD + Historia + Historia HD + H2 + H2 HD + HISTORY + History HD + CNN Headline News HD + CNN HEADLINE NEWS + Artv + Artv HD + Explora + Explora HD + RDI + RDI HD + Investigation + Investigation Discovery Canada + Investigation Discovery Canada HD + Investigation HD + KCPQ + KING + KIRO + KOMO + KTLA + KTLA HD + La chaîne Disney + La chaîne Disney HD + LCN + LCN HD + LIFETIME SD + LIFETIME HD + Oasis HD + DIY + MAMTL + MATV HD + MAX SD + MAX HD + MBC (USA) + MBCM (Masr) + Mediaset Italia + METEO + MeteoMedia HD + Mezzo + Mezzo HD + MLB Network SD + MOI ET CIE + MOI ET CIE + MovieTime + MovieTime HD + MSNBC + Razer + MTV Canada + MuchMusic + MuchMusic HD + National Geographic Canada + National Geographic HD + National Geographic Wild + National Geo Wild HD + NBA TV + NBA TV HD + NFL Network + NFL HD + Nickelodeon + NVSMT + NVMT + OTN + OUTDOOR LIFE + OWN Canada + OWN HD Canada + Out TV + Paramount SD + Paramount HD + Planète + Planète HD + PLAYBOY + PLAYBOY HD + Hard + Prise 2 + Prise 2 HD + RAI News + RDS + RDS2 + RDS2 HD + RDS HD + RDS Info + RDS Info HD + REVT + Rewind + Saint-Pierre-et-Miquelon + Saisons + Salt + Light TV + Séries Plus + Séries Plus HD + SHOW + Showcase HD + Silver Screen Classics + SkyNews HD + SkyNews SD + Slice + Slice HD + Sportsman Canada + The Score + The Score HD + Sports Net EST + Sports Net HD + Sports Net One + Sports Net One HD + Sports Net Ontario + Sportsnet Ontario HD + Sports Net Pacifique + Sports Net Pacifique HD + Sports Net West + Sports Net West HD + Sportsnet World + SNWHD + STARZ1 + STARZ1 HD + STARZ2 + STARZ2 HD + STVI + StudioCanal SD + StudioCanal HD + Super Channel 1 + Super Channel 1 HD + Super Channel 2 + Super Channel 2 HD + Super Channel 3 + Super Channel 3 HD + SE + SE HD + SE 2 + SE 2 HD + SE 3 + SE3 HD + SE 4 + SE4 HD + Télémagino SD + Télémagino HD + TLN Ninos + TOONA + TOONF + TOON A HD + TTF HD + TFO + TFO HD + TGCOM 24 + The Shopping Channel + WTHR + TLC + TLC HD + TLAT + Travel & Escape + Travel & Escape HD + TREE + TSN1 + TSN1 HD + TSN2 + TSN2 HD + TSN3 + TSN3 HD + TSN4 + TSN4 HD + TSN (5) + TSN HD (5) + Turner Classic Movie 1 + TCM HD + TV5 + TV5 HD + TVA Sports + TVA Sports 2 + TVA Sports 2 HD + TVA Sports HD + Tv Chile international + TVE1 + RAI Nettuno Sat Uno + UNIS + UNIS HD + Univision Canada + VISION + Vrak TV + Vrak HD + WCAX + WCFE + WETK + WETK HD + WFFF + WGN TV 9 + WGN9 HD + CHRGD SD + CHRGD HD + Wild + WTN + W Network HD + Peachtree HD + WPCH-TV + WPIX + WPIX HD + WPTZ + WSBK + WSBK HD + WVNDT + WWE + WWE HD + YOOPA + YOOPA HD + YTV + YTV HD + Z + Zeste + Zeste HD + Z HD + +