Merge pull request #2872 from iptv-org/CasperMcFadden95-patch-1

[Shahid] Add image, genre and fix season
This commit is contained in:
Aleksandr Statciuk
2025-09-28 19:58:47 +03:00
committed by GitHub

View File

@@ -22,8 +22,10 @@ module.exports = {
return { return {
title: item.title, title: item.title,
description: item.description, description: item.description,
session: item.seasonNumber, image: parseImage(item),
season: item.seasonNumber,
episode: item.episodeNumber, episode: item.episodeNumber,
category: item.genres,
start: dayjs.tz(item.actualFrom, 'UTC').toISOString(), start: dayjs.tz(item.actualFrom, 'UTC').toISOString(),
stop: dayjs.tz(item.actualTo, 'UTC').toISOString() stop: dayjs.tz(item.actualTo, 'UTC').toISOString()
} }
@@ -81,3 +83,22 @@ function parseItems(content, channel) {
return items 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
}