diff --git a/sites/canalplus-caraibes.com/canalplus-caraibes.com.config.js b/sites/canalplus-caraibes.com/canalplus-caraibes.com.config.js new file mode 100644 index 00000000..d8bf6115 --- /dev/null +++ b/sites/canalplus-caraibes.com/canalplus-caraibes.com.config.js @@ -0,0 +1,73 @@ +const axios = require('axios') +const cheerio = require('cheerio') +const dayjs = require('dayjs') +const utc = require('dayjs/plugin/utc') + +dayjs.extend(utc) + +module.exports = { + site: 'canalplus-caraibes.com', + url: function ({ channel, date }) { + const diff = date.diff(dayjs.utc().startOf('d'), 'd') + + return `https://service.canal-overseas.com/ott-frontend/vector/53001/channel/${channel.site_id}/events?filter.day=${diff}` + }, + logo({ channel }) { + return channel.logo + }, + parser: function ({ content }) { + let programs = [] + const items = parseItems(content) + items.forEach(item => { + if (item.title === 'Fin des programmes') return + programs.push({ + title: item.title, + icon: item.URLImageDefault, + start: parseStart(item).toJSON(), + stop: parseStop(item).toJSON() + }) + }) + + return programs + }, + async channels({ country }) { + const html = await axios + .get(`https://www.canalplus-caraibes.com/${country}/guide-tv-ce-soir`) + .then(r => r.data) + .catch(console.log) + + const $ = cheerio.load(html) + const script = $('body > script:nth-child(2)').html() + const [_, json] = script.match(/window.APP_STATE=(.*);/) || [null, null] + const data = JSON.parse(json) + const items = data.tvGuide.channels.byZapNumber + + return Object.values(items).map(item => { + return { + lang: 'fr', + site_id: item.epgID, + name: item.name, + logo: item.LogoUrl + } + }) + } +} + +function parseStart(item) { + return dayjs.unix(item.startTime) +} + +function parseStop(item) { + return dayjs.unix(item.endTime) +} + +function parseItems(content) { + const data = JSON.parse(content) + if (!data || !data.timeSlices) return [] + const items = data.timeSlices.reduce((acc, curr) => { + acc = acc.concat(curr.contents) + return acc + }, []) + + return items +} diff --git a/sites/canalplus-caraibes.com/canalplus-caraibes.com.test.js b/sites/canalplus-caraibes.com/canalplus-caraibes.com.test.js new file mode 100644 index 00000000..c2c61f08 --- /dev/null +++ b/sites/canalplus-caraibes.com/canalplus-caraibes.com.test.js @@ -0,0 +1,56 @@ +// [Geo-blocked] node ./scripts/channels.js --config=./sites/canalplus-caraibes.com/canalplus-caraibes.com.config.js --output=./sites/canalplus-caraibes.com/canalplus-caraibes.com_bl.channels.xml --set=country:bl +// npx epg-grabber --config=sites/canalplus-caraibes.com/canalplus-caraibes.com.config.js --channels=sites/canalplus-caraibes.com/canalplus-caraibes.com_bl.channels.xml --output=.gh-pages/guides/bl/canalplus-caraibes.com.epg.xml --days=2 + +const { parser, url, logo } = require('./canalplus-caraibes.com.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 channel = { + site_id: '60020', + xmltv_id: 'CanalPlusReunion.fr', + logo: 'https://service.canal-overseas.com/image-api/v1/image/702e588188caa19c38c438d14bfc8870' +} + +it('can generate valid url for today', () => { + const date = dayjs.utc().startOf('d') + expect(url({ channel, date })).toBe( + 'https://service.canal-overseas.com/ott-frontend/vector/53001/channel/60020/events?filter.day=0' + ) +}) + +it('can generate valid url for tomorrow', () => { + const date = dayjs.utc().startOf('d').add(1, 'd') + expect(url({ channel, date })).toBe( + 'https://service.canal-overseas.com/ott-frontend/vector/53001/channel/60020/events?filter.day=1' + ) +}) + +it('can get logo url', () => { + expect(logo({ channel })).toBe( + 'https://service.canal-overseas.com/image-api/v1/image/702e588188caa19c38c438d14bfc8870' + ) +}) + +it('can parse response', () => { + const content = `{"timeSlices":[{"contents":[{"title":"Fin des programmes","thirdTitle":"MA TV","startTime":1636768800,"endTime":1636855200,"onClick":{"displayTemplate":"miniDetail","displayName":"Fin des programmes","URLPage":"https://service.canal-overseas.com/ott-frontend/vector/63001/event/110427432","URLVitrine":"https://service.canal-overseas.com/ott-frontend/vector/63001/program/0/recommendations"},"programID":0,"diffusionID":"110427432","URLImageDefault":"https://service.canal-overseas.com/image-api/v1/image/generic","URLImage":"https://service.canal-overseas.com/image-api/v1/image/generic"}],"timeSlice":"0"},{"contents":[{"title":"Le cercle","subtitle":"5 Novembre 2021","thirdTitle":"CANAL+ HD","startTime":1636793201,"endTime":1636795901,"onClick":{"displayTemplate":"miniDetail","displayName":"Le cercle","URLPage":"https://service.canal-overseas.com/ott-frontend/vector/63001/event/110427540","URLVitrine":"https://service.canal-overseas.com/ott-frontend/vector/63001/program/193072081/recommendations"},"programID":193072081,"diffusionID":"110427540","URLImageDefault":"https://service.canal-overseas.com/image-api/v1/image/2a311987c642d97485d5f531e698dfb7","URLImage":"https://service.canal-overseas.com/image-api/v1/image/2de336e6a8c962921638c8aeee5f7e52"}],"timeSlice":"1"},{"contents":[],"timeSlice":"2"},{"contents":[],"timeSlice":"3"},{"contents":[],"timeSlice":"4"}]}` + const result = parser({ content }) + + expect(result).toMatchObject([ + { + start: '2021-11-13T08:46:41.000Z', + stop: '2021-11-13T09:31:41.000Z', + title: 'Le cercle', + icon: 'https://service.canal-overseas.com/image-api/v1/image/2a311987c642d97485d5f531e698dfb7' + } + ]) +}) + +it('can handle empty guide', () => { + const result = parser({ + content: `{"currentPage":{"displayTemplate":"error","BOName":"Page introuvable"},"title":"Page introuvable","text":"La page que vous demandez est introuvable. Si le problème persiste, vous pouvez contacter l'assistance de CANAL+/CANALSAT.","code":404}` + }) + expect(result).toMatchObject([]) +}) diff --git a/sites/canalplus-caraibes.com/canalplus-caraibes.com_bl.channels.xml b/sites/canalplus-caraibes.com/canalplus-caraibes.com_bl.channels.xml new file mode 100644 index 00000000..427bdd6e --- /dev/null +++ b/sites/canalplus-caraibes.com/canalplus-caraibes.com_bl.channels.xml @@ -0,0 +1,133 @@ + + + + 6ter + 13ème Rue + Action + Alizés + A+ + ARTE Français + Automoto la chaîne + BBC World News Americas + Bblack! Caribbean + BeIn Sports 1 France + BeIn Sports 2 France + BeIn Sports 3 France + BeIn Sports Max 4 France + BeIn Sports Max 5 France + C8 + Canal 10 + Canal J + Canal + Caraïbes + Canal + Cinéma France + Canal + Kids + Canal + Séries France + Canal + Sport France + Cine + Classic + Cine + Club + Cine + Émotion + Cine + Famiz + Cine + Frisson + Cine + Premier + C News + CNN International Latin America + Comédie + + C Star + Discovery Channel France + Discovery Science France + Disney Channel France + Disney Junior France + Disney+ France + Dorcel TV + E! France + English Club TV + Equidia + ES1 + ESPN 2 Caribbean + ESPN Caribbean + ETV + Eurosport 1 + Eurosport 2 + France 2 + France 3 + France 4 + France 5 + France 24 Français + Franceinfo: + Game One + Globo News + Golf + + Graphé TV + Guadeloupe 1ère + Gulli + Guyane 1ère + HBO Xtreme Latinoamérica + InfoSport + + IOTV + KMT + KTO + KTV Guyane + LCI + LCP Public Sénat + L'Équipe + Ludikids + M6 + Martinique 1ère + MCM France + Metropole + MTV France + MTV Hits France + National Geographic France + National Geographic Wild France + Nickelodeon France + Nick Jr Africa + Nollywood TV + Novelas TV + NRJ 12 + OCS choc + OCS City + OCS geants + OCS max + Paramount Channel France + Paris Première + Penthouse Black + Pink TV + Piwi + + Planète + + Planète + A&E + Planète + CI + RTL 9 + Seasons + Sony Channel Centro + STVS 8.1 + Syfy France + Télé 20 + Telemicro Internacional + Telemundo + Tele Pacific + Tele Soleil + TéléToon + + Téva + TF 1 + TF 1 Séries Films + TFX + TMC + TNH + Toute l'Histoire + Trace Ayiti + Trace Caribbean + Trace Gospel + Trace Latina + Trace Urban + TV5Monde Amérique Latine + TV Breizh + Ushuaïa TV + ViàATV + Vixen + W9 + Wataaa TV + XXL + Zitata TV + Zouk TV + + \ No newline at end of file diff --git a/sites/canalplus-caraibes.com/canalplus-caraibes.com_gf.channels.xml b/sites/canalplus-caraibes.com/canalplus-caraibes.com_gf.channels.xml new file mode 100644 index 00000000..427bdd6e --- /dev/null +++ b/sites/canalplus-caraibes.com/canalplus-caraibes.com_gf.channels.xml @@ -0,0 +1,133 @@ + + + + 6ter + 13ème Rue + Action + Alizés + A+ + ARTE Français + Automoto la chaîne + BBC World News Americas + Bblack! Caribbean + BeIn Sports 1 France + BeIn Sports 2 France + BeIn Sports 3 France + BeIn Sports Max 4 France + BeIn Sports Max 5 France + C8 + Canal 10 + Canal J + Canal + Caraïbes + Canal + Cinéma France + Canal + Kids + Canal + Séries France + Canal + Sport France + Cine + Classic + Cine + Club + Cine + Émotion + Cine + Famiz + Cine + Frisson + Cine + Premier + C News + CNN International Latin America + Comédie + + C Star + Discovery Channel France + Discovery Science France + Disney Channel France + Disney Junior France + Disney+ France + Dorcel TV + E! France + English Club TV + Equidia + ES1 + ESPN 2 Caribbean + ESPN Caribbean + ETV + Eurosport 1 + Eurosport 2 + France 2 + France 3 + France 4 + France 5 + France 24 Français + Franceinfo: + Game One + Globo News + Golf + + Graphé TV + Guadeloupe 1ère + Gulli + Guyane 1ère + HBO Xtreme Latinoamérica + InfoSport + + IOTV + KMT + KTO + KTV Guyane + LCI + LCP Public Sénat + L'Équipe + Ludikids + M6 + Martinique 1ère + MCM France + Metropole + MTV France + MTV Hits France + National Geographic France + National Geographic Wild France + Nickelodeon France + Nick Jr Africa + Nollywood TV + Novelas TV + NRJ 12 + OCS choc + OCS City + OCS geants + OCS max + Paramount Channel France + Paris Première + Penthouse Black + Pink TV + Piwi + + Planète + + Planète + A&E + Planète + CI + RTL 9 + Seasons + Sony Channel Centro + STVS 8.1 + Syfy France + Télé 20 + Telemicro Internacional + Telemundo + Tele Pacific + Tele Soleil + TéléToon + + Téva + TF 1 + TF 1 Séries Films + TFX + TMC + TNH + Toute l'Histoire + Trace Ayiti + Trace Caribbean + Trace Gospel + Trace Latina + Trace Urban + TV5Monde Amérique Latine + TV Breizh + Ushuaïa TV + ViàATV + Vixen + W9 + Wataaa TV + XXL + Zitata TV + Zouk TV + + \ No newline at end of file diff --git a/sites/canalplus-caraibes.com/canalplus-caraibes.com_gp.channels.xml b/sites/canalplus-caraibes.com/canalplus-caraibes.com_gp.channels.xml new file mode 100644 index 00000000..427bdd6e --- /dev/null +++ b/sites/canalplus-caraibes.com/canalplus-caraibes.com_gp.channels.xml @@ -0,0 +1,133 @@ + + + + 6ter + 13ème Rue + Action + Alizés + A+ + ARTE Français + Automoto la chaîne + BBC World News Americas + Bblack! Caribbean + BeIn Sports 1 France + BeIn Sports 2 France + BeIn Sports 3 France + BeIn Sports Max 4 France + BeIn Sports Max 5 France + C8 + Canal 10 + Canal J + Canal + Caraïbes + Canal + Cinéma France + Canal + Kids + Canal + Séries France + Canal + Sport France + Cine + Classic + Cine + Club + Cine + Émotion + Cine + Famiz + Cine + Frisson + Cine + Premier + C News + CNN International Latin America + Comédie + + C Star + Discovery Channel France + Discovery Science France + Disney Channel France + Disney Junior France + Disney+ France + Dorcel TV + E! France + English Club TV + Equidia + ES1 + ESPN 2 Caribbean + ESPN Caribbean + ETV + Eurosport 1 + Eurosport 2 + France 2 + France 3 + France 4 + France 5 + France 24 Français + Franceinfo: + Game One + Globo News + Golf + + Graphé TV + Guadeloupe 1ère + Gulli + Guyane 1ère + HBO Xtreme Latinoamérica + InfoSport + + IOTV + KMT + KTO + KTV Guyane + LCI + LCP Public Sénat + L'Équipe + Ludikids + M6 + Martinique 1ère + MCM France + Metropole + MTV France + MTV Hits France + National Geographic France + National Geographic Wild France + Nickelodeon France + Nick Jr Africa + Nollywood TV + Novelas TV + NRJ 12 + OCS choc + OCS City + OCS geants + OCS max + Paramount Channel France + Paris Première + Penthouse Black + Pink TV + Piwi + + Planète + + Planète + A&E + Planète + CI + RTL 9 + Seasons + Sony Channel Centro + STVS 8.1 + Syfy France + Télé 20 + Telemicro Internacional + Telemundo + Tele Pacific + Tele Soleil + TéléToon + + Téva + TF 1 + TF 1 Séries Films + TFX + TMC + TNH + Toute l'Histoire + Trace Ayiti + Trace Caribbean + Trace Gospel + Trace Latina + Trace Urban + TV5Monde Amérique Latine + TV Breizh + Ushuaïa TV + ViàATV + Vixen + W9 + Wataaa TV + XXL + Zitata TV + Zouk TV + + \ No newline at end of file diff --git a/sites/canalplus-caraibes.com/canalplus-caraibes.com_mf.channels.xml b/sites/canalplus-caraibes.com/canalplus-caraibes.com_mf.channels.xml new file mode 100644 index 00000000..427bdd6e --- /dev/null +++ b/sites/canalplus-caraibes.com/canalplus-caraibes.com_mf.channels.xml @@ -0,0 +1,133 @@ + + + + 6ter + 13ème Rue + Action + Alizés + A+ + ARTE Français + Automoto la chaîne + BBC World News Americas + Bblack! Caribbean + BeIn Sports 1 France + BeIn Sports 2 France + BeIn Sports 3 France + BeIn Sports Max 4 France + BeIn Sports Max 5 France + C8 + Canal 10 + Canal J + Canal + Caraïbes + Canal + Cinéma France + Canal + Kids + Canal + Séries France + Canal + Sport France + Cine + Classic + Cine + Club + Cine + Émotion + Cine + Famiz + Cine + Frisson + Cine + Premier + C News + CNN International Latin America + Comédie + + C Star + Discovery Channel France + Discovery Science France + Disney Channel France + Disney Junior France + Disney+ France + Dorcel TV + E! France + English Club TV + Equidia + ES1 + ESPN 2 Caribbean + ESPN Caribbean + ETV + Eurosport 1 + Eurosport 2 + France 2 + France 3 + France 4 + France 5 + France 24 Français + Franceinfo: + Game One + Globo News + Golf + + Graphé TV + Guadeloupe 1ère + Gulli + Guyane 1ère + HBO Xtreme Latinoamérica + InfoSport + + IOTV + KMT + KTO + KTV Guyane + LCI + LCP Public Sénat + L'Équipe + Ludikids + M6 + Martinique 1ère + MCM France + Metropole + MTV France + MTV Hits France + National Geographic France + National Geographic Wild France + Nickelodeon France + Nick Jr Africa + Nollywood TV + Novelas TV + NRJ 12 + OCS choc + OCS City + OCS geants + OCS max + Paramount Channel France + Paris Première + Penthouse Black + Pink TV + Piwi + + Planète + + Planète + A&E + Planète + CI + RTL 9 + Seasons + Sony Channel Centro + STVS 8.1 + Syfy France + Télé 20 + Telemicro Internacional + Telemundo + Tele Pacific + Tele Soleil + TéléToon + + Téva + TF 1 + TF 1 Séries Films + TFX + TMC + TNH + Toute l'Histoire + Trace Ayiti + Trace Caribbean + Trace Gospel + Trace Latina + Trace Urban + TV5Monde Amérique Latine + TV Breizh + Ushuaïa TV + ViàATV + Vixen + W9 + Wataaa TV + XXL + Zitata TV + Zouk TV + + \ No newline at end of file diff --git a/sites/canalplus-caraibes.com/canalplus-caraibes.com_mq.channels.xml b/sites/canalplus-caraibes.com/canalplus-caraibes.com_mq.channels.xml new file mode 100644 index 00000000..427bdd6e --- /dev/null +++ b/sites/canalplus-caraibes.com/canalplus-caraibes.com_mq.channels.xml @@ -0,0 +1,133 @@ + + + + 6ter + 13ème Rue + Action + Alizés + A+ + ARTE Français + Automoto la chaîne + BBC World News Americas + Bblack! Caribbean + BeIn Sports 1 France + BeIn Sports 2 France + BeIn Sports 3 France + BeIn Sports Max 4 France + BeIn Sports Max 5 France + C8 + Canal 10 + Canal J + Canal + Caraïbes + Canal + Cinéma France + Canal + Kids + Canal + Séries France + Canal + Sport France + Cine + Classic + Cine + Club + Cine + Émotion + Cine + Famiz + Cine + Frisson + Cine + Premier + C News + CNN International Latin America + Comédie + + C Star + Discovery Channel France + Discovery Science France + Disney Channel France + Disney Junior France + Disney+ France + Dorcel TV + E! France + English Club TV + Equidia + ES1 + ESPN 2 Caribbean + ESPN Caribbean + ETV + Eurosport 1 + Eurosport 2 + France 2 + France 3 + France 4 + France 5 + France 24 Français + Franceinfo: + Game One + Globo News + Golf + + Graphé TV + Guadeloupe 1ère + Gulli + Guyane 1ère + HBO Xtreme Latinoamérica + InfoSport + + IOTV + KMT + KTO + KTV Guyane + LCI + LCP Public Sénat + L'Équipe + Ludikids + M6 + Martinique 1ère + MCM France + Metropole + MTV France + MTV Hits France + National Geographic France + National Geographic Wild France + Nickelodeon France + Nick Jr Africa + Nollywood TV + Novelas TV + NRJ 12 + OCS choc + OCS City + OCS geants + OCS max + Paramount Channel France + Paris Première + Penthouse Black + Pink TV + Piwi + + Planète + + Planète + A&E + Planète + CI + RTL 9 + Seasons + Sony Channel Centro + STVS 8.1 + Syfy France + Télé 20 + Telemicro Internacional + Telemundo + Tele Pacific + Tele Soleil + TéléToon + + Téva + TF 1 + TF 1 Séries Films + TFX + TMC + TNH + Toute l'Histoire + Trace Ayiti + Trace Caribbean + Trace Gospel + Trace Latina + Trace Urban + TV5Monde Amérique Latine + TV Breizh + Ushuaïa TV + ViàATV + Vixen + W9 + Wataaa TV + XXL + Zitata TV + Zouk TV + + \ No newline at end of file