Update dstv.com.config.js

This commit is contained in:
Aleksandr Statciuk
2021-10-28 09:36:36 +03:00
parent 956f9b22a5
commit 2cfc3f7fb3

View File

@@ -42,18 +42,18 @@ module.exports = {
items.forEach(item => { items.forEach(item => {
const title = item.title const title = item.title
let start = parseStart(item, date) let start = parseStart(item, date)
if (start.hour() > 18 && !PM) return if (start.hour() > 18 && !PM) start = start.subtract(1, 'd')
if (start.hour() > 11 && start.hour() < 18) PM = true else if (start.hour() > 11 && start.hour() < 18) PM = true
if (start.hour() < 12 && PM) start = start.add(1, 'd') else if (start.hour() < 12 && PM) start = start.add(1, 'd')
const stop = start.add(30, 'm') const stop = start.add(1, 'h')
if (programs.length) { if (programs.length) {
programs[programs.length - 1].stop = start programs[programs.length - 1].stop = start.toString()
} }
programs.push({ programs.push({
title, title,
start, start: start.toString(),
stop stop: stop.toString()
}) })
}) })
@@ -69,8 +69,8 @@ function parseStart(item, date) {
function parseItems(content, date, channel) { function parseItems(content, date, channel) {
const [_, channelTag] = channel.site_id.split('#') const [_, channelTag] = channel.site_id.split('#')
const json = JSON.parse(content) const data = JSON.parse(content)
const html = json[channelTag] const html = data[channelTag]
if (!html) return [] if (!html) return []
const $ = cheerio.load(html) const $ = cheerio.load(html)