mirror of
https://github.com/iptv-org/epg
synced 2026-09-09 05:16:51 -04:00
Fix jiotv.com program image URLs
This commit is contained in:
@@ -64,15 +64,19 @@ function parseList(string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function parseIcon(item) {
|
function parseIcon(item) {
|
||||||
return item.episodeThumbnail
|
return parseImageUrl(item.episodeThumbnail)
|
||||||
? `https://jiotvimages.cdn.jio.com/dare_images/shows/700/-/${item.episodeThumbnail}`
|
|
||||||
: null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseImage(item) {
|
function parseImage(item) {
|
||||||
return item.episodePoster
|
return parseImageUrl(item.episodePoster)
|
||||||
? `https://jiotvimages.cdn.jio.com/dare_images/shows/700/-/${item.episodePoster}`
|
}
|
||||||
: null
|
|
||||||
|
function parseImageUrl(value) {
|
||||||
|
if (!value) return null
|
||||||
|
// paths like "epgdata/<hash>.jpg" are served from the CDN root, not from /dare_images/shows/<width>/-/
|
||||||
|
if (value.startsWith('epgdata/')) return `https://jiotvimages.cdn.jio.com/${value}`
|
||||||
|
|
||||||
|
return `https://jiotvimages.cdn.jio.com/dare_images/shows/700/-/${value}`
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseItems(content) {
|
function parseItems(content) {
|
||||||
|
|||||||
@@ -79,6 +79,29 @@ it('can parse response', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('can parse images served from the epgdata path', () => {
|
||||||
|
const content = JSON.stringify({
|
||||||
|
epg: [
|
||||||
|
{
|
||||||
|
showname: 'Power Lunch',
|
||||||
|
director: '',
|
||||||
|
starCast: '',
|
||||||
|
episodeThumbnail: 'epgdata/0e9fd651fd47416d3308954342235146.jpg',
|
||||||
|
episodePoster: 'epgdata/0e9fd651fd47416d3308954342235146.jpg',
|
||||||
|
startEpoch: 1753641000000,
|
||||||
|
endEpoch: 1753642800000
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
const results = parser({ content })
|
||||||
|
|
||||||
|
expect(results[0]).toMatchObject({
|
||||||
|
icon: 'https://jiotvimages.cdn.jio.com/epgdata/0e9fd651fd47416d3308954342235146.jpg',
|
||||||
|
image: 'https://jiotvimages.cdn.jio.com/epgdata/0e9fd651fd47416d3308954342235146.jpg'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
it('can handle empty guide', () => {
|
it('can handle empty guide', () => {
|
||||||
const results = parser({
|
const results = parser({
|
||||||
content: ''
|
content: ''
|
||||||
|
|||||||
Reference in New Issue
Block a user