mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Canal Plus description / category
canalplus-afrique.com canalplus-reunion.com canalplus-haiti.com canalplus-caraibes.com Added program description and category. Updated image to use program-specific image instead of generic default
This commit is contained in:
parent
f55bcadbe6
commit
75235fd122
4 changed files with 126 additions and 28 deletions
|
@ -12,18 +12,21 @@ module.exports = {
|
|||
|
||||
return `https://service.canal-overseas.com/ott-frontend/vector/83001/channel/${channel.site_id}/events?filter.day=${diff}`
|
||||
},
|
||||
parser: function ({ content }) {
|
||||
async parser({ content }) {
|
||||
let programs = []
|
||||
const items = parseItems(content)
|
||||
items.forEach(item => {
|
||||
for (let item of items) {
|
||||
if (item.title === 'Fin des programmes') return
|
||||
const detail = await loadProgramDetails(item)
|
||||
programs.push({
|
||||
title: item.title,
|
||||
icon: item.URLImageDefault,
|
||||
description:parseDescription(detail),
|
||||
category: parseCategory(detail),
|
||||
icon: parseIcon(item),
|
||||
start: parseStart(item),
|
||||
stop: parseStop(item)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
return programs
|
||||
},
|
||||
|
@ -49,6 +52,28 @@ module.exports = {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
}
|
||||
|
@ -67,3 +92,4 @@ function parseItems(content) {
|
|||
|
||||
return items
|
||||
}
|
||||
|
||||
|
|
|
@ -12,18 +12,21 @@ module.exports = {
|
|||
|
||||
return `https://service.canal-overseas.com/ott-frontend/vector/53001/channel/${channel.site_id}/events?filter.day=${diff}`
|
||||
},
|
||||
parser: function ({ content }) {
|
||||
async parser({ content }) {
|
||||
let programs = []
|
||||
const items = parseItems(content)
|
||||
items.forEach(item => {
|
||||
for (let item of items) {
|
||||
if (item.title === 'Fin des programmes') return
|
||||
const detail = await loadProgramDetails(item)
|
||||
programs.push({
|
||||
title: item.title,
|
||||
icon: item.URLImageDefault,
|
||||
start: parseStart(item).toJSON(),
|
||||
stop: parseStop(item).toJSON()
|
||||
})
|
||||
description:parseDescription(detail),
|
||||
category: parseCategory(detail),
|
||||
icon: parseIcon(item),
|
||||
start: parseStart(item),
|
||||
stop: parseStop(item)
|
||||
})
|
||||
}
|
||||
|
||||
return programs
|
||||
},
|
||||
|
@ -49,6 +52,26 @@ module.exports = {
|
|||
}
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
|
|
@ -12,18 +12,21 @@ module.exports = {
|
|||
|
||||
return `https://service.canal-overseas.com/ott-frontend/vector/53101/channel/${channel.site_id}/events?filter.day=${diff}`
|
||||
},
|
||||
parser: function ({ content }) {
|
||||
async parser({ content }) {
|
||||
let programs = []
|
||||
const items = parseItems(content)
|
||||
items.forEach(item => {
|
||||
for (let item of items) {
|
||||
if (item.title === 'Fin des programmes') return
|
||||
const detail = await loadProgramDetails(item)
|
||||
programs.push({
|
||||
title: item.title,
|
||||
icon: item.URLImageDefault,
|
||||
start: parseStart(item).toJSON(),
|
||||
stop: parseStop(item).toJSON()
|
||||
})
|
||||
description:parseDescription(detail),
|
||||
category: parseCategory(detail),
|
||||
icon: parseIcon(item),
|
||||
start: parseStart(item),
|
||||
stop: parseStop(item)
|
||||
})
|
||||
}
|
||||
|
||||
return programs
|
||||
},
|
||||
|
@ -49,6 +52,28 @@ module.exports = {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
const axios = require('axios')
|
||||
const dayjs = require('dayjs')
|
||||
const utc = require('dayjs/plugin/utc')
|
||||
|
||||
|
@ -10,23 +11,46 @@ module.exports = {
|
|||
|
||||
return `https://service.canal-overseas.com/ott-frontend/vector/63001/channel/${channel.site_id}/events?filter.day=${diff}`
|
||||
},
|
||||
parser: function ({ content }) {
|
||||
async parser({ content }) {
|
||||
let programs = []
|
||||
const items = parseItems(content)
|
||||
items.forEach(item => {
|
||||
for (let item of items) {
|
||||
if (item.title === 'Fin des programmes') return
|
||||
const detail = await loadProgramDetails(item)
|
||||
programs.push({
|
||||
title: item.title,
|
||||
icon: item.URLImageDefault,
|
||||
start: parseStart(item).toJSON(),
|
||||
stop: parseStop(item).toJSON()
|
||||
})
|
||||
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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue