From f8dceee7992a17eae52475eb58fe506900c030e8 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Mon, 8 Nov 2021 14:54:49 +0300 Subject: [PATCH 1/3] Create orange.fr.test.js --- sites/orange.fr/orange.fr.test.js | 53 +++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 sites/orange.fr/orange.fr.test.js diff --git a/sites/orange.fr/orange.fr.test.js b/sites/orange.fr/orange.fr.test.js new file mode 100644 index 00000000..209ac89b --- /dev/null +++ b/sites/orange.fr/orange.fr.test.js @@ -0,0 +1,53 @@ +// npx epg-grabber --config=sites/orange.fr/orange.fr.config.js --channels=sites/orange.fr/orange.fr_fr.channels.xml --output=.gh-pages/guides/fr/orange.fr.epg.xml --days=2 + +const { parser, url, logo, request } = require('./orange.fr.config.js') +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('2021-11-08', 'YYYY-MM-DD').startOf('d') +const channel = { + site_id: '192', + xmltv_id: 'TF1.fr', + logo: 'https://proxymedia.woopic.com/api/v1/images/553%2Flogos%2Fv2%2Flogos%2Flivetv_tf1%2F20180417_164011%2FwebTVLogo%2Flogo_180x96.png' +} +const content = `{"192":[{"id":1635062528017,"programType":"EPISODE","title":"Tête de liste","channelId":"192","channelZappingNumber":11,"covers":[{"format":"RATIO_16_9","url":"https://proxymedia.woopic.com/340/p/169_EMI_9697669.jpg"},{"format":"RATIO_4_3","url":"https://proxymedia.woopic.com/340/p/43_EMI_9697669.jpg"}],"diffusionDate":1636328100,"duration":2700,"csa":2,"synopsis":"Un tueur en série prend un plaisir pervers à prévenir les autorités de Tallahassee avant chaque nouveau meurtre. Rossi apprend le décès d'un de ses vieux amis.","languageVersion":"VM","hearingImpaired":true,"audioDescription":false,"season":{"number":10,"episodesCount":23,"serie":{"title":"Esprits criminels"}},"episodeNumber":12,"definition":"SD","links":[{"rel":"SELF","href":"https://rp-live.orange.fr/live-webapp/v3/applications/STB4PC/programs/1635062528017"}],"dayPart":"OTHER","catchupId":null,"genre":"Série","genreDetailed":"Série Suspense"}]}` + +it('can generate valid url', () => { + const result = url({ channel, date }) + expect(result).toBe( + 'https://rp-ott-mediation-tv.woopic.com/api-gw/live/v3/applications/STB4PC/programs?groupBy=channel&includeEmptyChannels=false&period=1636329600000,1636416000000&after=192&limit=1' + ) +}) + +it('can get logo url', () => { + const result = logo({ channel }) + expect(result).toBe( + 'https://proxymedia.woopic.com/api/v1/images/553%2Flogos%2Fv2%2Flogos%2Flivetv_tf1%2F20180417_164011%2FwebTVLogo%2Flogo_180x96.png' + ) +}) + +it('can parse response', () => { + const result = parser({ date, channel, content }) + expect(result).toMatchObject([ + { + start: '2021-11-07T23:35:00.000Z', + stop: '2021-11-08T00:20:00.000Z', + title: 'Tête de liste', + description: `Un tueur en série prend un plaisir pervers à prévenir les autorités de Tallahassee avant chaque nouveau meurtre. Rossi apprend le décès d'un de ses vieux amis.`, + category: 'Série Suspense', + icon: 'https://proxymedia.woopic.com/340/p/169_EMI_9697669.jpg' + } + ]) +}) + +it('can handle empty guide', () => { + const result = parser({ + date, + channel, + content: `{"code":60,"message":"Resource not found","param":{},"description":"L'URI demandé ou la ressource demandée n'existe pas.","stackTrace":null}` + }) + expect(result).toMatchObject([]) +}) From 6b7092f53ddb1f4a27d3e365a19b35df3e0e2711 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Mon, 8 Nov 2021 14:54:53 +0300 Subject: [PATCH 2/3] Create orange.fr.config.js --- sites/orange.fr/orange.fr.config.js | 49 +++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 sites/orange.fr/orange.fr.config.js diff --git a/sites/orange.fr/orange.fr.config.js b/sites/orange.fr/orange.fr.config.js new file mode 100644 index 00000000..2664c590 --- /dev/null +++ b/sites/orange.fr/orange.fr.config.js @@ -0,0 +1,49 @@ +const dayjs = require('dayjs') + +module.exports = { + site: 'orange.fr', + url({ channel, date }) { + return `https://rp-ott-mediation-tv.woopic.com/api-gw/live/v3/applications/STB4PC/programs?groupBy=channel&includeEmptyChannels=false&period=${date.valueOf()},${date + .add(1, 'd') + .valueOf()}&after=${channel.site_id}&limit=1` + }, + logo({ channel }) { + return channel.logo + }, + parser: function ({ content, channel }) { + let programs = [] + const items = parseItems(content, channel) + items.forEach(item => { + const start = parseStart(item) + const stop = parseStop(item, start) + programs.push({ + title: item.title, + category: item.genreDetailed, + description: item.synopsis, + icon: parseIcon(item), + start: start.toJSON(), + stop: stop.toJSON() + }) + }) + + return programs + } +} + +function parseIcon(item) { + return item.covers && item.covers.length ? item.covers[0].url : null +} + +function parseStart(item) { + return dayjs.unix(item.diffusionDate) +} + +function parseStop(item, start) { + return start.add(item.duration, 's') +} + +function parseItems(content, channel) { + const data = JSON.parse(content) + + return data && data[channel.site_id] ? data[channel.site_id] : [] +} From fa3800813fbeca569a6b8740ec8409ebca25f89e Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Mon, 8 Nov 2021 14:54:56 +0300 Subject: [PATCH 3/3] Create orange.fr_fr.channels.xml --- sites/orange.fr/orange.fr_fr.channels.xml | 200 ++++++++++++++++++++++ 1 file changed, 200 insertions(+) create mode 100644 sites/orange.fr/orange.fr_fr.channels.xml diff --git a/sites/orange.fr/orange.fr_fr.channels.xml b/sites/orange.fr/orange.fr_fr.channels.xml new file mode 100644 index 00000000..faec4faa --- /dev/null +++ b/sites/orange.fr/orange.fr_fr.channels.xml @@ -0,0 +1,200 @@ + + + + 01 TV + 2M Monde + 3sat + 6ter + AB 1 + Action + Aljazeera English + Animaux + A+ Kids TV + ARTE Français + Automoto la chaîne + BBC Entertainment Europe + BBC World News Europe + BeIn Sports 1 France + BeIn Sports 2 France + BeIn Sports 3 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 + BeIn Sports Max 10 France + BET France + BFM Business + BFM TV + Bloomberg TV Europe + Boing France + Boomerang France + Boomerang France +1 + C8 + Canal J + Canal + Cinéma France + Canal + Décalé + Canal + Docs + Canal + France + Canal + Kids + Canal + Séries France + Canal + Sport France + Canal Q + Cartoon Network France + Chasse & Pêche + Chérie 25 + Cine + Classic + Cine + Club + Cine + Émotion + Cine + Famiz + Cine + Frisson + Cine + Premier + Clique TV + Clubbing TV + CNBC Europe + C News + CNN International Europe + Comédie + + Comedy Central France + Crime District + C Star + Das Erste + Demain TV + Disney Channel France + Disney Channel France +1 + Disney Junior France + DW English + Equidia + ES1 + Eurochannel + EuroNews Français + FashionTV Europe + France 2 + France 3 + France 3 Alpes + France 3 Alsace + France 3 Aquitaine + France 3 Auvergne + 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 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 English + France 24 Français + Franceinfo: + Game One + Game One +1 + Golf Channel France + Gulli + Histoire TV + I24 News Français + J-One + KTO + LCI + LCP Assemblée Nationale + LCP Assemblée Nationale / Public Sénat + L'Équipe + Lucky Jack.tv + Luxe TV + M6 + M6 Music + Maison & Travaux TV + Mangas + MCM France + Melody + Melody d'Afrique + Mezzo + Mezzo Live HD + MTV France + MTV Hits France + Museum + MyZen TV + National Geographic France + National Geographic Wild France + NHK World Japan + Nickelodeon France + Nickelodeon France +1 + Nickelodeon Junior France + Nickelodeon Teen + Nitro Deutschland + Nollywood TV + Non Stop People France + Novelas TV + NRJ 12 + NRJ Hits + OCS choc + OCS City + OCS geants + OCS max + Olympia TV + One + Paramount Channel Décalé + Paramount Channel France + Paris Première + Piwi + + Planète + + Planète + A&E + Planète + CI + Polar + + ProSieben Deutschland + Rai 1 + Rai 2 + Rai 3 + Rai News 24 + RMC Découverte + RMC Story + RTL 9 + RTL Zwei Deutschland + RTP Internacional Europa + Science & Vie TV + Série Club + Sport en France + Stingray Classica + Sunu Yeuf + Super RTL Deutschland + TCM Cinéma + TéléToon + + TéléToon + 1 + Téva + TF 1 + TF 1 +1 + TF 1 Séries Films + TFX + The Israeli Network + Tiji + TMC + TMC +1 + Toonami France + Toute l'Histoire + TV5Monde France Belgique Suisse + TV Breizh + TVE Internacional Europa + TV Pitchoun + Ultra Nature + Ushuaïa TV + Vice TV France + Voxafrica Afrique + Vox Deutschland + W9 + Warner TV France + ZDF + ZDF Neo + + \ No newline at end of file