Create maxtv.hrvatskitelekom.hr.config.js

This commit is contained in:
Aleksandr Statciuk 2021-08-20 16:04:37 +03:00
parent 8ef0baeccf
commit da05ed3b7c

View file

@ -0,0 +1,46 @@
const dayjs = require('dayjs')
module.exports = {
lang: 'hr',
site: 'maxtv.hrvatskitelekom.hr',
channels: 'maxtv.hrvatskitelekom.hr.channels.xml',
output: '.gh-pages/guides/maxtv.hrvatskitelekom.hr.guide.xml',
request: {
method: 'POST',
data: function ({ channel, date }) {
return {
channelList: [channel.site_id],
startDate: date.startOf('d').unix(),
endDate: date.endOf('d').unix()
}
}
},
url: function ({ date, channel }) {
return `https://player.maxtvtogo.tportal.hr:8082/OTT4Proxy/proxy/epg/shows`
},
logo: function ({ content }) {
const json = JSON.parse(content)
return json.data ? json.data[0].logo : null
},
parser: function ({ content }) {
const programs = []
const json = JSON.parse(content)
if (!json.data) return programs
const items = json.data[0].shows
items.forEach(item => {
if (item.title && item.startTime && item.endTime) {
const start = dayjs.unix(item.startTime)
const stop = dayjs.unix(item.endTime)
programs.push({
title: item.title,
category: item.category,
start: start.toString(),
stop: stop.toString()
})
}
})
return programs
}
}