add season data to astro.com.my

This commit is contained in:
liimee
2023-07-09 10:14:03 +07:00
parent 92925ba5dc
commit 20fba59bcd
3 changed files with 11 additions and 3 deletions

View File

@@ -21,7 +21,7 @@ module.exports = {
const stop = start.add(duration, 's')
const details = await loadProgramDetails(item)
programs.push({
title: item.title,
title: details.title,
sub_title: item.subtitles,
description: details.longSynopsis || details.shortSynopsis,
actors: parseList(details.cast),
@@ -30,6 +30,7 @@ module.exports = {
rating: parseRating(details),
categories: parseCategories(details),
episode: parseEpisode(item),
season: parseSeason(details),
start: start,
stop: stop
})
@@ -45,6 +46,12 @@ function parseEpisode(item) {
return number ? parseInt(number) : null
}
function parseSeason(details) {
const [_, season] = details.title ? details.title.match(/ S(\d+)/) || [null, null] : [null, null]
return season ? parseInt(season) : null
}
function parseList(list) {
return typeof list === 'string' ? list.split(',') : []
}