mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 09:00:07 -04:00
Update movistarplus.es.config.js
This commit is contained in:
parent
ec9f8026ef
commit
ce79bee196
1 changed files with 34 additions and 30 deletions
|
@ -4,6 +4,7 @@ dayjs.extend(customParseFormat)
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
site: 'movistarplus.es',
|
site: 'movistarplus.es',
|
||||||
|
ignore: true, // removes the site from the list until the test is passed
|
||||||
url: function ({ date }) {
|
url: function ({ date }) {
|
||||||
return `https://www.movistarplus.es/programacion-tv/${date.format('YYYY-MM-DD')}?v=json`
|
return `https://www.movistarplus.es/programacion-tv/${date.format('YYYY-MM-DD')}?v=json`
|
||||||
},
|
},
|
||||||
|
@ -13,8 +14,11 @@ module.exports = {
|
||||||
if (!items.length) return programs
|
if (!items.length) return programs
|
||||||
let guideDate = date
|
let guideDate = date
|
||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
let startTime = dayjs(`${guideDate.format('YYYY-MM-DD')} ${item.HORA_INICIO}`,"YYYY-MM-DD HH:mm")
|
let startTime = dayjs(
|
||||||
let stopTime = dayjs(`${guideDate.format('YYYY-MM-DD')} ${item.HORA_FIN}`,"YYYY-MM-DD HH:mm")
|
`${guideDate.format('YYYY-MM-DD')} ${item.HORA_INICIO}`,
|
||||||
|
'YYYY-MM-DD HH:mm'
|
||||||
|
)
|
||||||
|
let stopTime = dayjs(`${guideDate.format('YYYY-MM-DD')} ${item.HORA_FIN}`, 'YYYY-MM-DD HH:mm')
|
||||||
if (stopTime.isBefore(startTime)) {
|
if (stopTime.isBefore(startTime)) {
|
||||||
guideDate = guideDate.add(1, 'd')
|
guideDate = guideDate.add(1, 'd')
|
||||||
stopTime = stopTime.add(1, 'd')
|
stopTime = stopTime.add(1, 'd')
|
||||||
|
@ -28,11 +32,11 @@ module.exports = {
|
||||||
})
|
})
|
||||||
return programs
|
return programs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseItems(content, channel) {
|
function parseItems(content, channel) {
|
||||||
const json = typeof content === 'string' ? JSON.parse(content) : content
|
const json = typeof content === 'string' ? JSON.parse(content) : content
|
||||||
if (!(`${channel.site_id}-CODE` in json.data)) return []
|
if (!(`${channel.site_id}-CODE` in json.data)) return []
|
||||||
const data = json.data[`${channel.site_id}-CODE`]
|
const data = json.data[`${channel.site_id}-CODE`]
|
||||||
return data ? data.PROGRAMAS : []
|
return data ? data.PROGRAMAS : []
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue