Initial Commit
This commit is contained in:
117
sites/canalplus-haiti.com/canalplus-haiti.com.channels.xml
Normal file
117
sites/canalplus-haiti.com/canalplus-haiti.com.channels.xml
Normal file
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<site site="canalplus-haiti.com">
|
||||
<channels>
|
||||
<channel lang="fr" xmltv_id="6ter.fr" site_id="51624">6ter</channel>
|
||||
<channel lang="fr" xmltv_id="13emeRue.fr" site_id="51001">13ème Rue</channel>
|
||||
<channel lang="fr" xmltv_id="Action.fr" site_id="51004">Action</channel>
|
||||
<channel lang="fr" xmltv_id="Alizes.gp" site_id="51365">Alizés</channel>
|
||||
<channel lang="fr" xmltv_id="APlus.fr" site_id="51416">A+</channel>
|
||||
<channel lang="fr" xmltv_id="Automotolachaine.fr" site_id="51565">Automoto la chaîne</channel>
|
||||
<channel lang="fr" xmltv_id="BBCWorldNewsNorthAmerica.uk" site_id="51008">BBC World News Americas</channel>
|
||||
<channel lang="fr" xmltv_id="BblackCaribbean.fr" site_id="51557">Bblack! Caribbean</channel>
|
||||
<channel lang="fr" xmltv_id="C8.fr" site_id="51120">C8</channel>
|
||||
<channel lang="fr" xmltv_id="Canal10.gp" site_id="51176">Canal 10</channel>
|
||||
<channel lang="fr" xmltv_id="CanalPlusCinemaFrance.fr" site_id="51014">Canal + Cinéma France</channel>
|
||||
<channel lang="fr" xmltv_id="CanalPlusHaiti.fr" site_id="51966">Canal + Haïti</channel>
|
||||
<channel lang="fr" xmltv_id="CanalPlusKids.fr" site_id="51401">Canal + Kids</channel>
|
||||
<channel lang="fr" xmltv_id="CanalPlusSportFrance.fr" site_id="51022">Canal + Sport France</channel>
|
||||
<channel lang="fr" xmltv_id="CinePlusClassic.fr" site_id="51328">Cine + Classic</channel>
|
||||
<channel lang="fr" xmltv_id="CinePlusClub.fr" site_id="51024">Cine + Club</channel>
|
||||
<channel lang="fr" xmltv_id="CinePlusEmotion.fr" site_id="51025">Cine + Émotion</channel>
|
||||
<channel lang="fr" xmltv_id="CinePlusFamiz.fr" site_id="51026">Cine + Famiz</channel>
|
||||
<channel lang="fr" xmltv_id="CinePlusFrisson.fr" site_id="51027">Cine + Frisson</channel>
|
||||
<channel lang="fr" xmltv_id="CinePlusPremier.fr" site_id="51028">Cine + Premier</channel>
|
||||
<channel lang="fr" xmltv_id="CNews.fr" site_id="51048">C News</channel>
|
||||
<channel lang="fr" xmltv_id="CNNInternationalLatinAmerica.us" site_id="51032">CNN International Latin America</channel>
|
||||
<channel lang="fr" xmltv_id="ComediePlus.fr" site_id="51033">Comédie +</channel>
|
||||
<channel lang="fr" xmltv_id="CStar.fr" site_id="51217">C Star</channel>
|
||||
<channel lang="fr" xmltv_id="Cuisines.fr" site_id="51711">Cuisines</channel>
|
||||
<channel lang="fr" xmltv_id="DiscoveryChannelFrance.fr" site_id="51248">Discovery Channel France</channel>
|
||||
<channel lang="fr" xmltv_id="DiscoveryScienceFrance.fr" site_id="51249">Discovery Science France</channel>
|
||||
<channel lang="fr" xmltv_id="DisneyChannelFrance.fr" site_id="51035">Disney Channel France</channel>
|
||||
<channel lang="fr" xmltv_id="DisneyJuniorFrance.fr" site_id="51075">Disney Junior France</channel>
|
||||
<channel lang="fr" xmltv_id="DorcelTVAfrica.nl" site_id="51702">Dorcel TV Africa</channel>
|
||||
<channel lang="fr" xmltv_id="EFrance.fr" site_id="51036">E! France</channel>
|
||||
<channel lang="fr" xmltv_id="EnglishClubTV.uk" site_id="51374">English Club TV</channel>
|
||||
<channel lang="fr" xmltv_id="MGGTV.fr" site_id="51667">ES1</channel>
|
||||
<channel lang="fr" xmltv_id="ESPN2Caribbean.us" site_id="51290">ESPN 2 Caribbean</channel>
|
||||
<channel lang="fr" xmltv_id="ESPNCaribbean.us" site_id="51038">ESPN Caribbean</channel>
|
||||
<channel lang="fr" xmltv_id="ETV.gp" site_id="51286">ETV</channel>
|
||||
<channel lang="fr" xmltv_id="Eurosport1.fr" site_id="51041">Eurosport 1</channel>
|
||||
<channel lang="fr" xmltv_id="Eurosport2.fr" site_id="51042">Eurosport 2</channel>
|
||||
<channel lang="fr" xmltv_id="France2.fr" site_id="51188">France 2</channel>
|
||||
<channel lang="fr" xmltv_id="France3.fr" site_id="51045">France 3</channel>
|
||||
<channel lang="fr" xmltv_id="France5.fr" site_id="51046">France 5</channel>
|
||||
<channel lang="fr" xmltv_id="France24French.fr" site_id="51114">France 24 Français</channel>
|
||||
<channel lang="fr" xmltv_id="Franceinfo.fr" site_id="51704">Franceinfo:</channel>
|
||||
<channel lang="fr" xmltv_id="GameOne.fr" site_id="51136">Game One</channel>
|
||||
<channel lang="fr" xmltv_id="GloboNews.br" site_id="51230">Globo News</channel>
|
||||
<channel lang="fr" xmltv_id="GrapheTV.mq" site_id="51937">Graphé TV</channel>
|
||||
<channel lang="fr" xmltv_id="Guadeloupe1ere.gp" site_id="51083">Guadeloupe 1ère</channel>
|
||||
<channel lang="fr" xmltv_id="Guyane1ere.gf" site_id="51084">Guyane 1ère</channel>
|
||||
<channel lang="fr" xmltv_id="HaitiSportsTV1.ht" site_id="51358">Haiti Sports TV 1</channel>
|
||||
<channel lang="fr" xmltv_id="HaitiSportsTV2.ht" site_id="51359">Haiti Sports TV 2</channel>
|
||||
<channel lang="fr" xmltv_id="HBOXtremeLatinAmerica.us" site_id="51363">HBO Xtreme Latinoamérica</channel>
|
||||
<channel lang="fr" xmltv_id="InfosportPlus.fr" site_id="51050">InfoSport +</channel>
|
||||
<channel lang="fr" xmltv_id="IOTV.sx" site_id="51611">IOTV</channel>
|
||||
<channel lang="fr" xmltv_id="KMT.mq" site_id="51210">KMT</channel>
|
||||
<channel lang="fr" xmltv_id="KTO.fr" site_id="51278">KTO</channel>
|
||||
<channel lang="fr" xmltv_id="KTVGuyane.gf" site_id="51288">KTV Guyane</channel>
|
||||
<channel lang="fr" xmltv_id="LCI.fr" site_id="51054">LCI</channel>
|
||||
<channel lang="fr" xmltv_id="PublicSenat.fr" site_id="51055">LCP Public Sénat</channel>
|
||||
<channel lang="fr" xmltv_id="LEquipe.fr" site_id="51056">L'Équipe</channel>
|
||||
<channel lang="fr" xmltv_id="Ludikids.fr" site_id="51931">Ludikids</channel>
|
||||
<channel lang="fr" xmltv_id="M6.fr" site_id="51057">M6</channel>
|
||||
<channel lang="fr" xmltv_id="Martinique1ere.mq" site_id="51085">Martinique 1ère</channel>
|
||||
<channel lang="fr" xmltv_id="MCM.fr" site_id="51060">MCM France</channel>
|
||||
<channel lang="fr" xmltv_id="Metropole.ht" site_id="51306">Metropole</channel>
|
||||
<channel lang="fr" xmltv_id="MTVFrance.fr" site_id="51065">MTV France</channel>
|
||||
<channel lang="fr" xmltv_id="MTVHitsFrance.fr" site_id="51147">MTV Hits France</channel>
|
||||
<channel lang="fr" xmltv_id="NathanTV.fr" site_id="51959">Nathan TV</channel>
|
||||
<channel lang="fr" xmltv_id="NationalGeographicFrance.fr" site_id="51145">National Geographic France</channel>
|
||||
<channel lang="fr" xmltv_id="NationalGeographicWildFrance.fr" site_id="51223">National Geographic Wild France</channel>
|
||||
<channel lang="fr" xmltv_id="NickelodeonFrance.fr" site_id="51224">Nickelodeon France</channel>
|
||||
<channel lang="fr" xmltv_id="NickJrAfrica.za" site_id="51941">Nick Jr Africa</channel>
|
||||
<channel lang="fr" xmltv_id="NollywoodTV.fr" site_id="51418">Nollywood TV</channel>
|
||||
<channel lang="fr" xmltv_id="NovelasTV.fr" site_id="51548">Novelas TV</channel>
|
||||
<channel lang="fr" xmltv_id="NRJ12.fr" site_id="51216">NRJ 12</channel>
|
||||
<channel lang="fr" xmltv_id="ParamountChannelFrance.fr" site_id="51303">Paramount Channel France</channel>
|
||||
<channel lang="fr" xmltv_id="ParisPremiere.fr" site_id="51070">Paris Première</channel>
|
||||
<channel lang="fr" xmltv_id="PenthouseBlack.us" site_id="51280">Penthouse Black</channel>
|
||||
<channel lang="fr" xmltv_id="PiwiPlus.fr" site_id="51128">Piwi +</channel>
|
||||
<channel lang="fr" xmltv_id="PlanetePlus.fr" site_id="51072">Planète +</channel>
|
||||
<channel lang="fr" xmltv_id="PlanetePlusAE.fr" site_id="51073">Planète + A&E</channel>
|
||||
<channel lang="fr" xmltv_id="PlanetePlusCI.fr" site_id="51142">Planète + CI</channel>
|
||||
<channel lang="fr" xmltv_id="RTL9.lu" site_id="51077">RTL 9</channel>
|
||||
<channel lang="fr" xmltv_id="Seasons.fr" site_id="51079">Seasons</channel>
|
||||
<!-- <channel lang="fr" xmltv_id="" site_id="51422">Sony Channel Centro</channel> -->
|
||||
<channel lang="fr" xmltv_id="Studiocanal.fr" site_id="51942">Studiocanal</channel>
|
||||
<channel lang="fr" xmltv_id="STVS81.sr" site_id="51616">STVS 8.1</channel>
|
||||
<channel lang="fr" xmltv_id="SyfyFrance.fr" site_id="51078">Syfy France</channel>
|
||||
<channel lang="fr" xmltv_id="Tele20.ht" site_id="51618">Télé 20</channel>
|
||||
<channel lang="fr" xmltv_id="TelemicroInternacional.do" site_id="51292">Telemicro Internacional</channel>
|
||||
<channel lang="fr" xmltv_id="TelemundoCentralAmerica.us" site_id="51725">Telemundo</channel>
|
||||
<channel lang="fr" xmltv_id="TelePacific.ht" site_id="51617">Tele Pacific</channel>
|
||||
<channel lang="fr" xmltv_id="TeleSoleil.ht" site_id="51936">Tele Soleil</channel>
|
||||
<channel lang="fr" xmltv_id="TeletoonPlus.fr" site_id="51148">TéléToon +</channel>
|
||||
<channel lang="fr" xmltv_id="TF1.fr" site_id="51095">TF 1</channel>
|
||||
<channel lang="fr" xmltv_id="TF1SeriesFilms.fr" site_id="51613">TF 1 Séries Films</channel>
|
||||
<channel lang="fr" xmltv_id="TFX.fr" site_id="51067">TFX</channel>
|
||||
<channel lang="fr" xmltv_id="TNH.ht" site_id="51291">TNH</channel>
|
||||
<channel lang="fr" xmltv_id="ToutelHistoire.fr" site_id="51727">Toute l'Histoire</channel>
|
||||
<channel lang="fr" xmltv_id="TraceAyiti.fr" site_id="51654">Trace Ayiti</channel>
|
||||
<channel lang="fr" xmltv_id="TraceCaribbean.fr" site_id="51155">Trace Caribbean</channel>
|
||||
<channel lang="fr" xmltv_id="TraceGospel.fr" site_id="51620">Trace Gospel</channel>
|
||||
<channel lang="fr" xmltv_id="TraceLatina.fr" site_id="51653">Trace Latina</channel>
|
||||
<channel lang="fr" xmltv_id="TraceUrban.fr" site_id="51102">Trace Urban</channel>
|
||||
<channel lang="fr" xmltv_id="TV5MondeLatinAmerica.fr" site_id="51106">TV5Monde Amérique Latine</channel>
|
||||
<channel lang="fr" xmltv_id="TVCaraibes.ht" site_id="51423">TV Caraïbes</channel>
|
||||
<channel lang="fr" xmltv_id="UshuaiaTV.fr" site_id="51138">Ushuaïa TV</channel>
|
||||
<channel lang="fr" xmltv_id="ViaATV.mq" site_id="51006">ViàATV</channel>
|
||||
<channel lang="fr" xmltv_id="VixenTV.ca" site_id="51934">Vixen</channel>
|
||||
<channel lang="fr" xmltv_id="WataaaTV.fr" site_id="51614">Wataaa TV</channel>
|
||||
<channel lang="fr" xmltv_id="XXL.fr" site_id="51110">XXL</channel>
|
||||
<channel lang="fr" xmltv_id="ZitataTV.mq" site_id="51801">Zitata TV</channel>
|
||||
<channel lang="fr" xmltv_id="ZoukTV.mq" site_id="51285">Zouk TV</channel>
|
||||
</channels>
|
||||
</site>
|
||||
94
sites/canalplus-haiti.com/canalplus-haiti.com.config.js
Normal file
94
sites/canalplus-haiti.com/canalplus-haiti.com.config.js
Normal file
@@ -0,0 +1,94 @@
|
||||
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-haiti.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/53101/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 channels() {
|
||||
const html = await axios
|
||||
.get(`https://www.canalplus-haiti.com/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
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
175
sites/canalplus-haiti.com/canalplus-haiti.com.test.js
Normal file
175
sites/canalplus-haiti.com/canalplus-haiti.com.test.js
Normal file
@@ -0,0 +1,175 @@
|
||||
// [Geo-blocked] npm run channels:parse --config=./sites/canalplus-haiti.com/canalplus-haiti.com.config.js --output=./sites/canalplus-haiti.com/canalplus-haiti.com.channels.xml
|
||||
// npx epg-grabber --config=sites/canalplus-haiti.com/canalplus-haiti.com.config.js --channels=sites/canalplus-haiti.com/canalplus-haiti.com.channels.xml --output=guide.xml --days=2
|
||||
|
||||
const { parser, url } = require('./canalplus-haiti.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: '51006',
|
||||
xmltv_id: 'ViaATV.mq'
|
||||
}
|
||||
|
||||
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/53101/channel/51006/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/53101/channel/51006/events?filter.day=1'
|
||||
)
|
||||
})
|
||||
|
||||
it('can parse response', done => {
|
||||
const content = `{
|
||||
"timeSlices": [
|
||||
{
|
||||
"contents": [
|
||||
{
|
||||
"title": "New Amsterdam - S3 - Ep7",
|
||||
"subtitle": "Episode 7 - Le mur de la honte",
|
||||
"thirdTitle": "viaATV",
|
||||
"startTime": 1660780500,
|
||||
"endTime": 1660783200,
|
||||
"onClick": {
|
||||
"displayTemplate": "miniDetail",
|
||||
"displayName": "New Amsterdam - S3 - Ep7",
|
||||
"URLPage": "https://service.canal-overseas.com/ott-frontend/vector/53101/event/140952809",
|
||||
"URLVitrine": "https://service.canal-overseas.com/ott-frontend/vector/53101/program/187882282/recommendations"
|
||||
},
|
||||
"programID": 187882282,
|
||||
"diffusionID": "140952809",
|
||||
"URLImageDefault": "https://service.canal-overseas.com/image-api/v1/image/generic",
|
||||
"URLImage": "https://service.canal-overseas.com/image-api/v1/image/52a18a209e28380b199201961c27097e"
|
||||
}
|
||||
],
|
||||
"timeSlice": "2"
|
||||
}
|
||||
]
|
||||
}`
|
||||
axios.get.mockImplementation(url => {
|
||||
if (url === 'https://service.canal-overseas.com/ott-frontend/vector/53101/event/140952809') {
|
||||
return Promise.resolve({
|
||||
data: JSON.parse(`{
|
||||
"currentPage": {
|
||||
"displayName": "New Amsterdam - S3 - Ep7",
|
||||
"displayTemplate": "detailPage",
|
||||
"URLVitrine": "https://service.canal-overseas.com/ott-frontend/vector/53101/program/187882282/recommendations"
|
||||
},
|
||||
"detail": {
|
||||
"informations": {
|
||||
"programmeType": "EPG",
|
||||
"isInOffer": false,
|
||||
"isInOfferOnDevice": false,
|
||||
"isInOfferForD2G": false,
|
||||
"availableInVoDOnDevice": false,
|
||||
"availableInVoDOnG5": false,
|
||||
"availableInD2GOnDevice": false,
|
||||
"availableInLiveOnDevice": false,
|
||||
"rediffusions": true,
|
||||
"canBeRecorded": false,
|
||||
"channelName": "viaATV",
|
||||
"startTime": 1660780500,
|
||||
"endTime": 1660783200,
|
||||
"title": "New Amsterdam - S3 - Ep7",
|
||||
"subtitle": "Episode 7 - Le mur de la honte",
|
||||
"thirdTitle": "viaATV",
|
||||
"genre": "Séries",
|
||||
"subGenre": "Série Hôpital",
|
||||
"editorialTitle": "Séries, Etats-Unis, 2020, 0h45",
|
||||
"audioLanguage": "VF",
|
||||
"personnalities": [
|
||||
{
|
||||
"prefix": "De :",
|
||||
"content": "Darnell Martin"
|
||||
},
|
||||
{
|
||||
"prefix": "Avec :",
|
||||
"content": "André De Shields, Anna Suzuki, Anupam Kher, Baylen Thomas, Christine Chang, Craig Wedren, Daniel Dae Kim, Dierdre Friel, Em Grosland, Emma Ramos, Freema Agyeman, Gina Gershon, Graham Norris, Jamie Ann Romero, Janet Montgomery, Jefferson Friedman, Joshua Gitta, Kerry Flanagan, Larry Bryggman, Mike Doyle, Nora Clow, Opal Clow, Ryan Eggold, Simone Policano, Stephen Spinella, Tyler Labine"
|
||||
}
|
||||
],
|
||||
"summary": "C'est la journée nationale de dépistage du VIH et Max offre des soins gratuits à tous les malades séropositifs qui se présentent à New Amsterdam.",
|
||||
"summaryMedium": "C'est la journée nationale de dépistage du VIH et Max offre des soins gratuits à tous les malades séropositifs qui se présentent à New Amsterdam.",
|
||||
"programID": 187882282,
|
||||
"sharingURL": "https://www.canalplus-haiti.com/grille-tv/event/140952809-new-amsterdam-s3-ep7.html",
|
||||
"labels": {
|
||||
"allocine": false,
|
||||
"telerama": false,
|
||||
"sensCritique": false
|
||||
},
|
||||
"EpgId": 51006,
|
||||
"CSA": 1,
|
||||
"HD": false,
|
||||
"3D": false,
|
||||
"diffusionID": "140952809",
|
||||
"duration": "2700",
|
||||
"URLImageDefault": "https://service.canal-overseas.com/image-api/v1/image/generic",
|
||||
"URLImage": "https://service.canal-overseas.com/image-api/v1/image/52a18a209e28380b199201961c27097e",
|
||||
"URLLogo": "https://service.canal-overseas.com/image-api/v1/image/0f67b2e85f74101c4c776cf423240fce",
|
||||
"URLLogoBlack": "https://service.canal-overseas.com/image-api/v1/image/0f67b2e85f74101c4c776cf423240fce",
|
||||
"URLVitrine": "https://service.canal-overseas.com/ott-frontend/vector/53101/program/187882282/recommendations"
|
||||
},
|
||||
"diffusions": [
|
||||
{
|
||||
"diffusionDateUTC": 1660780500,
|
||||
"sharingUrl": "https://www.canalplus-haiti.com/grille-tv/event/140952809-new-amsterdam.html",
|
||||
"broadcastId": "140952809",
|
||||
"name": "viaATV",
|
||||
"epgID": "51006",
|
||||
"ZapNumber": "28",
|
||||
"URLLogo": "https://service.canal-overseas.com/image-api/v1/image/0f67b2e85f74101c4c776cf423240fce",
|
||||
"URLLogoBlack": "https://service.canal-overseas.com/image-api/v1/image/0f67b2e85f74101c4c776cf423240fce"
|
||||
}
|
||||
]
|
||||
}
|
||||
}`)
|
||||
})
|
||||
} 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-17T23:55:00.000Z',
|
||||
stop: '2022-08-18T00:40:00.000Z',
|
||||
title: 'New Amsterdam - S3 - Ep7',
|
||||
icon: 'https://service.canal-overseas.com/image-api/v1/image/52a18a209e28380b199201961c27097e',
|
||||
category: 'Série Hôpital',
|
||||
description:
|
||||
"C'est la journée nationale de dépistage du VIH et Max offre des soins gratuits à tous les malades séropositifs qui se présentent à New Amsterdam."
|
||||
}
|
||||
])
|
||||
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)
|
||||
})
|
||||
Reference in New Issue
Block a user