Update tvgid.ua.config.js

This commit is contained in:
Aleksandr Statciuk 2021-09-24 17:15:03 +03:00
parent 9e928c1b87
commit 0852777e59

View file

@ -10,9 +10,9 @@ dayjs.extend(utc)
dayjs.extend(timezone)
dayjs.extend(customParseFormat)
let PM = false
module.exports = {
lang: 'uk',
days: 3,
site: 'tvgid.ua',
channels: 'tvgid.ua.channels.xml',
output: '.gh-pages/guides/tvgid.ua.guide.xml',
@ -20,6 +20,7 @@ module.exports = {
return `https://tvgid.ua/channels/${channel.site_id}/${date.format('DDMMYYYY')}/tmall/`
},
parser: function ({ buffer, date }) {
let PM = false
const programs = []
const items = parseItems(buffer)
items.forEach(item => {
@ -28,7 +29,7 @@ module.exports = {
if (!start) return
if (start.hour() > 11) PM = true
if (start.hour() < 12 && PM) start = start.add(1, 'd')
const stop = parseStop(item, start)
const stop = start.add(1, 'h')
if (programs.length) {
programs[programs.length - 1].stop = start
}
@ -40,10 +41,6 @@ module.exports = {
}
}
function parseStop(item, date) {
return date.hour(7)
}
function parseStart(item, date) {
let time = (item.querySelector('td > table > tbody > tr > td.time') || { textContent: '' })
.textContent