diff --git a/sites/canalplus-reunion.com/canalplus-reunion.com.channels.xml b/sites/canalplus-reunion.com/canalplus-reunion.com.channels.xml deleted file mode 100644 index af09df49..00000000 --- a/sites/canalplus-reunion.com/canalplus-reunion.com.channels.xml +++ /dev/null @@ -1,121 +0,0 @@ - - - 13ème Rue - 6ter - Action - Antenne Réunion TV - A+ - ARTE Français - Automoto la chaîne - BBC World News Africa - BeIn Sports 1 France - BeIn Sports 2 France - BeIn Sports 3 France - C8 - Canal + Cinéma Réunion - Canal + Décalé - Canal + Kids - Canal + Réunion - Canal + Séries Réunion - Canal + Sport Réunion - CGTN Français - Cine + Classic - Cine + Club - Cine + Émotion - Cine + Famiz - Cine + Frisson - Cine + Premier - C News - Colmax TV - Colors - Comédie + - C Star - Discovery Channel France - Discovery Science France - Disney Channel France - Disney Junior France - Dorcel TV Africa - E! France - English Club TV - Equidia - Eurosport 1 France - Eurosport 2 France - France 2 - France 24 Français - France 3 - France 4 - France 5 - Franceinfo: - Game One - Golf + - Gulli - Histoire TV - InfoSport + - Iqraa Africa & Europe - Kanal Austral TV - Kolo TV - KTO - Kwezi TV - LCI - LCP Assemblée Nationale - L'Équipe - Ludikids - M6 - Mayotte 1ère - MBS - Mezzo - MTV France - MTV Hits France - MTV India - National Geographic France - National Geographic Wild France - Nickelodeon France - Nickelodeon Junior France - Nollywood TV - Novegasy - Novelas TV - NRJ 12 - OCS choc - OCS City - OCS geants - OCS max - ORTC TV - Paramount Channel France - Paris Première - Penthouse Black - Piwi + - Planète + - Planète + A&E - Planète + CI - Réunion 1ère - RFM TV - RTA - RTL 9 - Seasons - Série Club - Syfy France - Télé Kréol - TéléToon + - Téva - TF 1 - TF 1 Séries Films - TFX - TMC - Trace Caribbean - Trace Urban Afrique - Trace Vanilla Islands - Trek - TV5Monde Afrique - TV Breizh - TV Malagasy - TV Plus Madagascar - TV Record Madagascar - Ushuaïa TV - Vixen - W9 - Wataaa TV - XXL - Zee Cinema Africa - Zee TV Africa - Zing UK - \ No newline at end of file diff --git a/sites/canalplus-reunion.com/canalplus-reunion.com.config.js b/sites/canalplus-reunion.com/canalplus-reunion.com.config.js deleted file mode 100644 index 54032a86..00000000 --- a/sites/canalplus-reunion.com/canalplus-reunion.com.config.js +++ /dev/null @@ -1,72 +0,0 @@ -const axios = require('axios') -const dayjs = require('dayjs') -const utc = require('dayjs/plugin/utc') - -dayjs.extend(utc) - -module.exports = { - site: 'canalplus-reunion.com', - days: 2, - url: function ({ channel, date }) { - const diff = date.diff(dayjs.utc().startOf('d'), 'd') - - return `https://service.canal-overseas.com/ott-frontend/vector/63001/channel/${channel.site_id}/events?filter.day=${diff}` - }, - async parser({ content }) { - let programs = [] - const items = parseItems(content) - for (let item of items) { - if (item.title === 'Fin des programmes') return - const detail = await loadProgramDetails(item) - programs.push({ - title: item.title, - description: parseDescription(detail), - category: parseCategory(detail), - icon: parseIcon(item), - start: parseStart(item), - stop: parseStop(item) - }) - } - - return programs - } -} - -async function loadProgramDetails(item) { - if (!item.onClick.URLPage) return {} - const url = item.onClick.URLPage - const data = await axios - .get(url) - .then(r => r.data) - .catch(console.log) - return data || {} -} - -function parseDescription(detail) { - return detail.detail.informations.summary || null -} - -function parseCategory(detail) { - return detail.detail.informations.subGenre || null -} -function parseIcon(item) { - return item.URLImage || item.URLImageDefault -} -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-reunion.com/canalplus-reunion.com.test.js b/sites/canalplus-reunion.com/canalplus-reunion.com.test.js deleted file mode 100644 index cb521795..00000000 --- a/sites/canalplus-reunion.com/canalplus-reunion.com.test.js +++ /dev/null @@ -1,160 +0,0 @@ -// npm run grab -- --site=canalplus-reunion.com - -const { parser, url } = require('./canalplus-reunion.com.config.js') -const axios = require('axios') -const dayjs = require('dayjs') -const utc = require('dayjs/plugin/utc') -const customParseFormat = require('dayjs/plugin/customParseFormat') -dayjs.extend(customParseFormat) -dayjs.extend(utc) - -jest.mock('axios') - -const channel = { - site_id: '60243', - xmltv_id: 'beINSports2France.fr' -} - -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/63001/channel/60243/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/63001/channel/60243/events?filter.day=1' - ) -}) - -it('can parse response', done => { - const content = `{ - "timeSlices": [ - { - "contents": [ - { - "title": "Almeria / Real Madrid", - "subtitle": "Football", - "thirdTitle": "BEIN SPORTS 2 HD", - "startTime": 1660780800, - "endTime": 1660788000, - "onClick": { - "displayTemplate": "miniDetail", - "displayName": "Almeria / Real Madrid", - "URLPage": "https://service.canal-overseas.com/ott-frontend/vector/63001/event/140382363", - "URLVitrine": "https://service.canal-overseas.com/ott-frontend/vector/63001/program/224523053/recommendations" - }, - "programID": 224523053, - "diffusionID": "140382363", - "URLImageDefault": "https://service.canal-overseas.com/image-api/v1/image/a6b640e16608ffa3d862e2bd8a4b3e4c", - "URLImage": "https://service.canal-overseas.com/image-api/v1/image/47000149dabce60d1769589c766aad20" - } - ], - "timeSlice": "4" - } - ] - }` - axios.get.mockImplementation(url => { - if (url === 'https://service.canal-overseas.com/ott-frontend/vector/63001/event/140382363') { - return Promise.resolve({ - data: JSON.parse(`{ - "currentPage": { - "displayName": "Almeria / Real Madrid", - "displayTemplate": "detailPage", - "URLVitrine": "https://service.canal-overseas.com/ott-frontend/vector/63001/program/224523053/recommendations" - }, - "detail": { - "informations": { - "programmeType": "EPG", - "isInOffer": false, - "isInOfferOnDevice": false, - "isInOfferForD2G": false, - "availableInVoDOnDevice": false, - "availableInVoDOnG5": false, - "availableInD2GOnDevice": false, - "availableInLiveOnDevice": false, - "rediffusions": true, - "canBeRecorded": false, - "channelName": "BEIN SPORTS 2 HD", - "startTime": 1660780800, - "endTime": 1660788000, - "title": "Almeria / Real Madrid", - "subtitle": "Football", - "thirdTitle": "BEIN SPORTS 2 HD", - "genre": "Sport", - "subGenre": "Football", - "editorialTitle": "Sport, Espagne, 2h00", - "audioLanguage": "VF", - "summary": "Diffusion d'un match de LaLiga Santander, championnat d'Espagne de football, la plus haute compétition de football d'Espagne. Cette compétition professionnelle, placée sous la supervision de la Fédération espagnole de football, a été fondée en 1928 et s'appelle Primera Division jusqu'en 2008. Elle se nomme ensuite Liga BBVA jusqu'en 2016 puis LaLiga Santander depuis cette date.", - "summaryMedium": "Diffusion d'un match de LaLiga Santander, championnat d'Espagne de football, la plus haute compétition de football d'Espagne. Cette compétition professionnelle, placée sous la supervision de la Fédération espagnole de football, a été fondée en 1928 et s'appelle Primera Division jusqu'en 2008. Elle se nomme ensuite Liga BBVA jusqu'en 2016 puis LaLiga Santander depuis cette date.", - "programID": 224523053, - "sharingURL": "https://www.canalplus-reunion.com/grille-tv/event/140382363-almeria-real-madrid.html", - "EpgId": 60243, - "CSA": 1, - "HD": false, - "3D": false, - "diffusionID": "140382363", - "duration": "7200", - "URLImageDefault": "https://service.canal-overseas.com/image-api/v1/image/a6b640e16608ffa3d862e2bd8a4b3e4c", - "URLImage": "https://service.canal-overseas.com/image-api/v1/image/47000149dabce60d1769589c766aad20", - "URLLogo": "https://service.canal-overseas.com/image-api/v1/image/6e2124827406ed41236a8430352d4ed9", - "URLLogoBlack": "https://service.canal-overseas.com/image-api/v1/image/6e2124827406ed41236a8430352d4ed9", - "URLVitrine": "https://service.canal-overseas.com/ott-frontend/vector/63001/program/224523053/recommendations" - }, - "diffusions": [ - { - "diffusionDateUTC": 1660780800, - "sharingUrl": "https://www.canalplus-reunion.com/grille-tv/event/140382363-almeria-real-madrid.html", - "broadcastId": "140382363", - "name": "BEIN SPORTS 2 HD", - "epgID": "60243", - "ZapNumber": "96", - "URLLogo": "https://service.canal-overseas.com/image-api/v1/image/6e2124827406ed41236a8430352d4ed9", - "URLLogoBlack": "https://service.canal-overseas.com/image-api/v1/image/6e2124827406ed41236a8430352d4ed9" - } - ] - } - }`) - }) - } else { - return Promise.resolve({ data: '' }) - } - }) - - parser({ content }) - .then(result => { - result = result.map(p => { - p.start = p.start.toJSON() - p.stop = p.stop.toJSON() - return p - }) - - expect(result).toMatchObject([ - { - start: '2022-08-18T00:00:00.000Z', - stop: '2022-08-18T02:00:00.000Z', - title: 'Almeria / Real Madrid', - icon: 'https://service.canal-overseas.com/image-api/v1/image/47000149dabce60d1769589c766aad20', - category: 'Football', - description: - "Diffusion d'un match de LaLiga Santander, championnat d'Espagne de football, la plus haute compétition de football d'Espagne. Cette compétition professionnelle, placée sous la supervision de la Fédération espagnole de football, a été fondée en 1928 et s'appelle Primera Division jusqu'en 2008. Elle se nomme ensuite Liga BBVA jusqu'en 2016 puis LaLiga Santander depuis cette date." - } - ]) - done() - }) - .catch(done) -}) - -it('can handle empty guide', done => { - 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}' - }) - .then(result => { - expect(result).toMatchObject([]) - done() - }) - .catch(done) -})