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