From 0ff123b7b13a4b279a7530365660ac61214d31e5 Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Sun, 26 Nov 2023 14:27:32 +0300 Subject: [PATCH] Update programme-tv.net --- sites/programme-tv.net/__data__/content.html | 6622 +++++++++++++++++ .../programme-tv.net.channels.xml | 516 +- .../programme-tv.net.config.js | 40 +- .../programme-tv.net/programme-tv.net.test.js | 61 + sites/programme-tv.net/readme.md | 21 + 5 files changed, 7045 insertions(+), 215 deletions(-) create mode 100644 sites/programme-tv.net/__data__/content.html create mode 100644 sites/programme-tv.net/programme-tv.net.test.js create mode 100644 sites/programme-tv.net/readme.md diff --git a/sites/programme-tv.net/__data__/content.html b/sites/programme-tv.net/__data__/content.html new file mode 100644 index 00000000..3764a42c --- /dev/null +++ b/sites/programme-tv.net/__data__/content.html @@ -0,0 +1,6622 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Programme TV TF1 de demain - Télé-Loisirs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+
+
+ + + + + Publicité +
+
+
+
+
+
+
+
+
+
+ + Retour à la page d'accueil + + +

Programme TV TF1 du lundi 27 novembre

+
+ + +
+ + Date : Lundi 27 Novembre + + +
+ +
+ +
+
+
+
+ +
+
+
+
+
+ +
+ + Accéder au replay de TF1 + +
+ +
    +
  • +
    +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + +
    +
    +

    + 01h05 +

    +
    + +

    + + Programmes de la nuit + +

    + +
    +

    Autre

    +
    + +
    +

    + 5h25min + + + + + +

    +
    +
    +
    + +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + +
    +
    +

    + 06h30 +

    +
    + +

    + + TFou + +

    + +
    +

    Culture Infos

    +
    + +
    +

    + 1h55min + + + + + +

    +
    +
    +
    + +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + +
    +
    +

    + 08h25 +

    +
    + +

    + + Météo + +

    + +
    +

    Autre

    +
    + +
    +

    + 5min + + + + + +

    +
    +
    +
    + +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + +
    +
    +

    + 08h30 +

    +
    + +

    + + Téléshopping + +

    + +
    +

    Culture Infos

    +
    + +
    +

    + 1h20min + + + + + +

    +
    +
    +
    + +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + +
    +
    +

    + 09h50 +

    +
    + +

    + + Météo + +

    + +
    +

    Autre

    +
    + +
    +

    + 5min + + + + + +

    +
    +
    +
    + +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + +
    +
    +

    + 09h55 +

    +
    + +

    + + Familles nombreuses : la vie en XXL + +

    + +

    Episode 83

    + +
    +

    Autre

    +
    + +
    +

    + 35min + + + + + +

    +
    +
    +
    + +
    +
    +
    La suite sous cette publicité
    +
    +
    + + + + + Publicité +
    +
    +
    +
    +
    + +
    +
    +
    + + + + + Publicité +
    + +
    +
    +
    + +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + +
    +
    +

    + 10h30 +

    +
    + +

    + + Amour, gloire et beauté + +

    + +

    Episode 8912

    + +
    +

    Divertissement

    +
    + +
    +

    + 30min + Rediffusion + + + + + +

    +
    +
    +
    + +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + +
    +
    +

    + 11h00 +

    +
    + +

    + + Les Feux de l'amour + +

    + +
    +

    Divertissement

    +
    + +
    +

    + 45min + Inédit + + + + + +

    +
    +
    +
    +
    + +
    +
    +
    La suite sous cette publicité
    +
    +
    + + + + + Publicité +
    +
    +
    +
    +
    +
  • + +
  • +
    +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + +
    +
    +

    + 11h45 +

    +
    + +

    + + Petits plats en équilibre + +

    + +
    +

    Culture Infos

    +
    + +
    +

    + 5min + + + + + +

    +
    +
    +
    + +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + +
    +
    +

    + 11h50 +

    +
    + +

    + + Les douze coups de midi + +

    + +
    +

    Autre

    +
    + +
    +

    + 1h05min + + + + + +

    +
    +
    +
    + +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + +
    +
    +

    + 12h55 +

    +
    + +

    + + Petits plats en équilibre + +

    + +
    +

    Culture Infos

    +
    + +
    +

    + 5min + + + + + +

    +
    +
    +
    + +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + +
    +
    +

    + 13h00 +

    +
    + +

    + + Journal + +

    + +
    +

    Autre

    +
    + +
    +

    + 40min + Direct + + + + + +

    +
    +
    +
    + +
    +
    +
    + + + + + Publicité +
    + +
    +
    +
    + +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + +
    +
    +

    + 13h40 +

    +
    + +

    + + Petits plats en équilibre + +

    + +
    +

    Culture Infos

    +
    + +
    +

    + 10min + + + + + +

    +
    +
    +
    + +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + +
    +
    +

    + 13h50 +

    +
    + +

    + + Météo + +

    + +
    +

    Autre

    +
    + +
    +

    + 10min + + + + + +

    +
    +
    +
    + +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + +
    +
    +

    + 14h00 +

    +
    + +

    + + Une famille surprise pour Noël + +

    + +
    +

    Téléfilm

    +
    + +
    +

    + 1h40min + Inédit + + + + + +

    +
    +
    +
    + +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + +
    +
    +

    + 15h40 +

    +
    + +

    + + Sauver une vie pour Noël + +

    + +
    +

    Téléfilm

    +
    + +
    +

    + 1h45min + Rediffusion + + + + + +

    +
    +
    +
    +
    + +
    +
    +
    La suite sous cette publicité
    +
    +
    + + + + + Publicité +
    +
    +
    +
    +
    +
  • + +
  • +
    +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + +
    +
    +

    + 17h25 +

    +
    + +

    + + Star Academy, la quotidienne + +

    + +
    +

    Autre

    +
    + +
    +

    + 1h05min + + + + + +

    +
    +
    +
    + +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + +
    +
    +

    + 18h30 +

    +
    + +

    + + Ici tout commence + +

    + +

    Episode 804

    + +
    +

    Série TV

    +
    + +
    +

    + 40min + Inédit + + + + + +

    +
    +
    +
    + +
    +
    La suite sous cette publicité
    +
    +
    + + + + + Publicité +
    + +
    +
    +
    + +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + +
    +
    +

    + 19h10 +

    +
    + +

    + + Demain nous appartient + +

    + +

    Episode 1565

    + +
    +

    Série TV

    +
    + +
    +

    + 45min + Inédit + + + + + +

    +
    +
    +
    + +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + +
    +
    +

    + 19h55 +

    +
    + +

    + + Météo + +

    + +
    +

    Autre

    +
    + +
    +

    + 5min + + + + + +

    +
    +
    +
    + +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + +
    +
    +

    + 20h00 +

    +
    + +

    + + Journal + +

    + +
    +

    Autre

    +
    + +
    +

    + 45min + + + + + +

    +
    +
    +
    + +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + +
    +
    +

    + 20h45 +

    +
    + +

    + + Tirage du Loto + +

    + +
    +

    Autre

    +
    + +
    +

    + 5min + + + + + +

    +
    +
    +
    + +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + +
    +
    +

    + 20h50 +

    +
    + +

    + + Météo + +

    + +
    +

    Autre

    +
    + +
    +

    + 10min + + + + + +

    +
    +
    +
    + +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + +
    +
    +

    + 21h00 +

    +
    + +

    + + C'est Canteloup + +

    + +
    +

    Autre

    +
    + +
    +

    + 10min + + + + + +

    +
    +
    +
    +
    + +
    +
    +
    La suite sous cette publicité
    +
    +
    + + + + + Publicité +
    +
    +
    +
    +
    +
  • + +
  • +
    +
    +
    +
    +
    + + + + +
    + Lire le résumé +
    +
    +
    +
    + +
    +
    +

    + 21h10 +

    +
    + +

    + + Trois frères, Noël et un couffin + +

    + +
    +

    Téléfilm

    +
    + +
    +

    + 50min + + + + + +

    +
    +
    +
    + +
    +
    +
    +
    + + + + +
    + Lire le résumé +
    +
    +
    +
    + +
    +
    +

    + 22h00 +

    +
    + +

    + + Trois frères, Noël et un couffin + +

    + +
    +

    Téléfilm

    +
    + +
    +

    + 55min + + + + + +

    +
    +
    +
    + +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + +
    +
    +

    + 22h55 +

    +
    + +

    + + Coup de foudre chez le Père Noël + +

    + +
    +

    Téléfilm

    +
    + +
    +

    + 55min + + + + + +

    +
    +
    +
    + +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + +
    +
    +

    + 23h50 +

    +
    + +

    + + Coup de foudre chez le Père Noël + +

    + +
    +

    Téléfilm

    +
    + +
    +

    + 55min + + + + + +

    +
    +
    +
    +
    + +
    +
    +
    La suite sous cette publicité
    +
    +
    + + + + + Publicité +
    +
    +
    +
    +
    +
  • +
+
+
+ + + +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+ + + + + Publicité +
+
+
+
+
+ +
+
Dans l'actu
+
Notre sélection de news
+ + + + + +
+ +
+
La suite sous cette publicité
+
+
+ + + + + Publicité +
+
+
+
+ +
+
+
+
+
+ +
+
+
La suite sous cette publicité
+
+
+ + + + + Publicité +
+
+
+
+
+
+
+ + +
+
+ + + + + +
+
+
+ + + +
+ +
+ +
+ + + + diff --git a/sites/programme-tv.net/programme-tv.net.channels.xml b/sites/programme-tv.net/programme-tv.net.channels.xml index f914b2a3..163ec458 100644 --- a/sites/programme-tv.net/programme-tv.net.channels.xml +++ b/sites/programme-tv.net/programme-tv.net.channels.xml @@ -1,214 +1,302 @@ - - - RTL - 13ème Rue - 6ter - AB 1 - AB 3 - Action - Aljazeera English - Altice Studio - Animaux - A+ - ARTE Français - Automoto la chaîne - Baby TV Europe - BBC Entertainment Europe - BBC Four - BBC One - BBC Two - BeIn Sports 1 France - BeIn Sports 2 France - BeIn Sports 3 France - BeIn Sports Max 10 France - BeIn Sports Max 4 France - BeIn Sports Max 5 France - BeIn Sports Max 6 France - BeIn Sports Max 7 France - BeIn Sports Max 8 France - BeIn Sports Max 9 France - BET France - BFM Business - BFM Lyon - BFM Paris - BFM TV - Boing France - B-One TV - Boomerang France - C8 - Canal J - Canal + Cinéma France - Canal + Décalé - Canal + Docs - Canal + Formula 1 - Canal + France - Canal + Grand Ecran France - Canal + Kids - Canal + Moto GP - Canal + Premier League - Canal + Séries France - Canal + Sport France - Canal + Top 14 - Canvas - Cartoon Network France - Chasse & Pêche - Chérie 25 - Cine + Classic - Cine + Club - Cine + Émotion - Cine + Famiz - Cine + Frisson - Cine + Premier - Club RTL - C News - CNN International Europe - Comédie + - Comedy Central France - Crime District - C Star - Das Erste - Discovery Channel France - Discovery Family - Discovery Science France - Disney Channel France - Disney Junior France - Één - E! France - Equidia - Eurochannel - EuroNews Français - Eurosport 1 France - Eurosport 2 France - FashionTV Europe - France 2 - France 24 Français - France 3 - France 3 Alpes - France 3 Alsace - France 3 Aquitaine - France 3 Auvergne - France 3 Basse-Normandie - France 3 Bourgogne - France 3 Bretagne - France 3 Centre-Val de Loire - France 3 Champagne-Ardenne - France 3 Corse Via Stella - France 3 Côte d'Azur - France 3 Franche-Comté - France 3 Haute-Normandie - France 3 Languedoc-Roussillon - France 3 Limousin - France 3 Lorraine - France 3 Midi-Pyrénées - France 3 Nord Pas-de-Calais - France 3 Paris Ile-de-France - France 3 Pays de la Loire - France 3 Picardie - France 3 Poitou-Charentes - France 3 Provence-Alpes - France 3 Rhône-Alpes - France 4 - France 5 - Game One - Ginx eSports TV International - Golf Channel France - Golf + - Gulli - Histoire TV - I24 News Français - InfoSport + - J-One - Ketnet - KTO - La Chaîne Météo - RTBF La Une - LCI - LCP Assemblée Nationale - L'Équipe - M6 - M6 Music - Mangas - MCM France - MCM Top - Melody - Mezzo - Mezzo Live HD - MTV France - MTV Hits Europe - MTV Hits France - MyZen TV - National Geographic France - National Geographic Wild France - Nautical Channel - Nickelodeon France - Nickelodeon Junior France - Nickelodeon Teen - Nollywood TV - Non Stop People France - Novelas TV - NPO 1 - NPO 2 - NRJ 12 - NRJ Hits - OCS choc - OCS City - OCS geants - OCS max - OLTV - Paramount Channel France - Paris Première - Pink TV - Piwi + - Planète + - Planète + CI - Play 4 - Play 5 - Plug RTL - Polar + - Rai 1 - RFM TV - RMC Découverte - RMC Sport 1 - RMC Sport UHD - RMC Sport 2 - RMC Story - RT France - RTL 9 - RTL TVI - RTP Internacional Europa - RTS 1 - RTS 2 - Science & Vie TV - Seasons - Série Club - Stingray Djazz - Stingray IConcerts - Syfy France - TCM Cinéma - TéléToon + - Téva - TF 1 - TF 1 Séries Films - TFX - Tiji - Tipik - TMC - Toonami France - Toute l'Histoire - Trace Africa Français - Trace Sport Stars - Trace Urban - Trek - TV5Monde France Belgique Suisse - TV Breizh - TVE Internacional Europa - Ushuaïa TV - VH1 Europe - VTM - VTM 2 - VTM 3 - W9 - Warner TV France - XXL - ZDF - + + + RTL Télévision + + 6ter + 13eme RUE + AB 1 + AB 3 + Action + Al Jazeera English + Altice Studio + Animaux + A+ International France + Arte + Automoto + Baby TV + BBC Entertainment + BBC4 + BBC 1 + BBC 2 + beIN SPORTS 1 + beIN SPORTS 2 + beIN SPORTS 3 + beIN SPORTS MAX 4 + beIN SPORTS MAX 5 + beIN SPORTS MAX 6 + beIN SPORTS MAX 7 + beIN SPORTS MAX 8 + beIN SPORTS MAX 9 + beIN SPORTS MAX 10 + BET + BFM Business + BFM Lyon Métropole + BFM Paris + Boing + B.One + Boomerang + C8 + Canal J + Canal+ + Canal+ Cinéma + Canal+ Décalé + Canal+ Docs + Canal+ Formula 1 + Canal+ Grand Ecran + Canal+ KIDS + Canal+ Moto GP + Canal+ Premier League + Canal+ Séries + Canal+ Sport + Canal+ Top 14 + Canvas + Cartoon Network + Chasse et pêche + Chérie 25 + Ciné+ Classic + Ciné+ Club + Ciné+ Emotion + Ciné+ Famiz + Ciné+ Frisson + Ciné+ Premier + Club RTL + CNEWS + CNN + Comédie+ + Comedy Central + Crime District + CSTAR + Das Erste + Discovery Channel + Discovery Family + Discovery Science + Disney Channel + Disney Junior + E ! + één + Equidia + Eurochannel + Euronews + Eurosport 1 + Eurosport 2 + Fashion TV + France 2 + France 3 + France 3 Alpes + France 3 Alsace + France 3 Aquitaine + France 3 Auvergne + France 3 Basse-Normandie + France 3 Bourgogne + France 3 Bretagne + France 3 Centre-Val de Loire + France 3 Champagne-Ardennes + France 3 Corse Via Stella + France 3 Côte d'Azur + France 3 Franche-Comté + France 3 Haute-Normandie + France 3 Languedoc-Roussillon + France 3 Limousin + France 3 Lorraine + France 3 Midi-Pyrénées + France 3 Nord Pas-de-Calais + France 3 Paris Ile-de-France + France 3 Pays de la Loire + France 3 Picardie + France 3 Poitou-Charentes + France 3 Provence-Alpes + France 3 Rhône-Alpes + France 4 + France 5 + France 24 + Game One + Ginx + Golf Channel + Golf+ + Gulli + Histoire TV + I24news + Infosport+ + J-One + Ketnet + KTO + La Chaîne Météo + La Une + LCI - La Chaîne Info + La Chaîne parlementaire + L'Equipe + M6 + M6 Music + Mangas + MCM + MCM Top + Melody + Mezzo + Mezzo Live HD + VH1 + MTV + MTV Hits (France) + MTV Hits + MyZen.tv + National Geographic + Nat Geo Wild + Nautical Channel + Nickelodéon + Nickelodeon Junior + Nickelodéon Teen + Nollywood TV + Non Stop People HD + Novelas TV + NPO1 + NPO2 + NRJ 12 + NRJ Hits + OCS City + OCS Géants + OCS Max + OLTV + Paramount Channel + Paris Première + Pink TV + Piwi+ + Planète+ + Planète+ Crime Investigation + Vier + Plug RTL + Polar+ + Rai Uno + RFM TV + RMC Découverte + RMC Sport 1 + RMC Sport 1 UHD + RMC Sport 2 + RMC Story + RTL 9 + RTL TVI + RTPI + RTS Un + RTS Deux + Science & Vie TV + Seasons + serieclub + Stingray Djazz + Stingray i-Concerts + Syfy + TCM Cinéma + TéléToon+ + Téva + TF1 + TF1 Séries Films + TFX + TIJI + Tipik + TMC + Toonami + Toute l'histoire + Trace Africa + TRACE Sport Stars + Trace Urban + Trek + TV5MONDE + TvBreizh + TVE + Ushuaïa TV + VTM + W9 + Warner TV + XXL + ZDF + diff --git a/sites/programme-tv.net/programme-tv.net.config.js b/sites/programme-tv.net/programme-tv.net.config.js index 5231aa3b..57c4a564 100644 --- a/sites/programme-tv.net/programme-tv.net.config.js +++ b/sites/programme-tv.net/programme-tv.net.config.js @@ -13,6 +13,11 @@ dayjs.extend(customParseFormat) module.exports = { site: 'programme-tv.net', days: 2, + request: { + headers: { + cookie: 'authId=b7154156fe4fb8acdb6f38e1207c6231' + } + }, url: function ({ date, channel }) { return `https://www.programme-tv.net/programme/chaine/${date.format('YYYY-MM-DD')}/programme-${ channel.site_id @@ -34,6 +39,39 @@ module.exports = { }) return programs + }, + async channels() { + const axios = require('axios') + const data = await axios + .get( + `https://www.programme-tv.net/_esi/channel-list/${dayjs().format( + 'YYYY-MM-DD' + )}/?bouquet=perso&modal=0`, + { + headers: { + cookie: 'authId=b7154156fe4fb8acdb6f38e1207c6231' + } + } + ) + .then(r => r.data) + .catch(console.error) + + let channels = [] + + const $ = cheerio.load(data) + $('.channelList-listItemsLink').each((i, el) => { + const name = $(el).attr('title') + const url = $(el).attr('href') + const [, site_id] = url.match(/\/programme\-(.*)\.html$/i) + + channels.push({ + lang: 'fr', + site_id, + name + }) + }) + + return channels } } @@ -59,7 +97,7 @@ function parseIcon($item) { } function parseCategory($item) { - return $item('.mainBroadcastCard-genre').first().text().trim() + return $item('.mainBroadcastCard-format').first().text().trim() } function parseTitle($item) { diff --git a/sites/programme-tv.net/programme-tv.net.test.js b/sites/programme-tv.net/programme-tv.net.test.js new file mode 100644 index 00000000..da40c8b9 --- /dev/null +++ b/sites/programme-tv.net/programme-tv.net.test.js @@ -0,0 +1,61 @@ +const { parser, url, request } = require('./programme-tv.net.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-27', 'YYYY-MM-DD').startOf('d') +const channel = { + site_id: 'tf1-19', + xmltv_id: 'TF1.fr' +} + +it('can generate valid url', () => { + expect(request.headers).toMatchObject({ + cookie: 'authId=b7154156fe4fb8acdb6f38e1207c6231' + }) +}) + +it('can generate valid url', () => { + expect(url({ date, channel })).toBe( + 'https://www.programme-tv.net/programme/chaine/2023-11-27/programme-tf1-19.html' + ) +}) + +it('can parse response', () => { + const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.html')) + let results = parser({ content, date }) + results = results.map(p => { + p.start = p.start.toJSON() + p.stop = p.stop.toJSON() + return p + }) + + expect(results[0]).toMatchObject({ + start: '2023-11-27T00:05:00.000Z', + stop: '2023-11-27T05:30:00.000Z', + title: 'Programmes de la nuit', + category: 'Autre', + icon: 'https://www.programme-tv.net/imgre/fit/~2~program~978eb86d5b99cee0.jpg/128x180/quality/80/programmes-de-la-nuit.jpg' + }) + + expect(results[27]).toMatchObject({ + start: '2023-11-27T22:50:00.000Z', + stop: '2023-11-27T23:45:00.000Z', + title: 'Coup de foudre chez le Père Noël', + category: 'Téléfilm', + icon: 'https://www.programme-tv.net/imgre/fit/~2~program~5a4e78779c4a3fac.jpg/128x180/quality/80/coup-de-foudre-chez-le-pere-noel.jpg' + }) +}) + +it('can handle empty guide', () => { + const results = parser({ + content: '', + date + }) + + expect(results).toMatchObject([]) +}) diff --git a/sites/programme-tv.net/readme.md b/sites/programme-tv.net/readme.md new file mode 100644 index 00000000..7f790e81 --- /dev/null +++ b/sites/programme-tv.net/readme.md @@ -0,0 +1,21 @@ +# programme-tv.net + +https://www.programme-tv.net/ + +### Download the guide + +```sh +npm run grab -- --site=programme-tv.net +``` + +### Update channel list + +```sh +npm run channels:parse -- --config=./sites/programme-tv.net/programme-tv.net.config.js --output=./sites/programme-tv.net/programme-tv.net.channels.xml +``` + +### Test + +```sh +npm test -- programme-tv.net +```