Filter out repeated schedule events from sky.com.

Signed-off-by: Toha <tohenk@yahoo.com>
This commit is contained in:
Toha 2025-01-01 17:51:47 +07:00
parent 1b62393008
commit 67509d97b1
No known key found for this signature in database
GPG key ID: 2D7AA6389D44DCAB

View file

@ -18,7 +18,7 @@ module.exports = {
channel.site_id channel.site_id
}` }`
}, },
parser({ content, channel }) { parser({ content, channel, date }) {
const programs = [] const programs = []
if (content) { if (content) {
const items = JSON.parse(content) || null const items = JSON.parse(content) || null
@ -30,15 +30,16 @@ module.exports = {
schedule.events schedule.events
.forEach(event => { .forEach(event => {
const start = dayjs.utc(event.st * 1000) const start = dayjs.utc(event.st * 1000)
const stop = start.add(event.d, 's') if (start.isSame(date, 'd')) {
programs.push({ programs.push({
title: event.t, title: event.t,
description: event.sy, description: event.sy,
season: event.seasonnumber, season: event.seasonnumber,
episode: event.episodenumber, episode: event.episodenumber,
start, start,
stop stop: start.add(event.d, 's')
}) })
}
}) })
} }
}) })