Update ontvtonight.com.config.js

This commit is contained in:
Aleksandr Statciuk 2021-08-27 17:11:54 +03:00
parent 0ace0feca7
commit dab0737cd6

View file

@ -38,15 +38,17 @@ module.exports = {
items.forEach(item => { items.forEach(item => {
const title = parseTitle(item) const title = parseTitle(item)
const start = parseStart(item, date) const start = parseStart(item, date)
const stop = parseStop(item, date)
if (title && start) { if (title && start) {
if (programs.length && !programs[programs.length - 1].stop) { if (programs.length) {
programs[programs.length - 1].stop = start programs[programs.length - 1].stop = start
} }
programs.push({ programs.push({
title, title,
start start,
stop
}) })
} }
}) })
@ -55,6 +57,10 @@ module.exports = {
} }
} }
function parseStop(item, date) {
return date.tz('Europe/London').endOf('d')
}
function parseStart(item, date) { function parseStart(item, date) {
let time = (item.querySelector('td:nth-child(1) > h5') || { textContent: '' }).textContent.trim() let time = (item.querySelector('td:nth-child(1) > h5') || { textContent: '' }).textContent.trim()
time = `${date.format('DD/MM/YYYY')} ${time.toUpperCase()}` time = `${date.format('DD/MM/YYYY')} ${time.toUpperCase()}`