mirror of
https://github.com/iptv-org/epg
synced 2025-12-16 02:16:40 -05:00
Merge pull request #2872 from iptv-org/CasperMcFadden95-patch-1
[Shahid] Add image, genre and fix season
This commit is contained in:
@@ -22,8 +22,10 @@ module.exports = {
|
||||
return {
|
||||
title: item.title,
|
||||
description: item.description,
|
||||
session: item.seasonNumber,
|
||||
image: parseImage(item),
|
||||
season: item.seasonNumber,
|
||||
episode: item.episodeNumber,
|
||||
category: item.genres,
|
||||
start: dayjs.tz(item.actualFrom, 'UTC').toISOString(),
|
||||
stop: dayjs.tz(item.actualTo, 'UTC').toISOString()
|
||||
}
|
||||
@@ -81,3 +83,22 @@ function parseItems(content, channel) {
|
||||
|
||||
return items
|
||||
}
|
||||
|
||||
function parseImage(item) {
|
||||
// image may have params such as width that needs to be substituted or removed for it load
|
||||
return removeParameters(item.productPoster)
|
||||
}
|
||||
|
||||
function removeParameters(url) {
|
||||
if (url) {
|
||||
try {
|
||||
const urlObj = new URL(url)
|
||||
urlObj.search = ''
|
||||
urlObj.hash = ''
|
||||
return urlObj.toString()
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
return url
|
||||
}
|
||||
Reference in New Issue
Block a user