mirror of
https://github.com/iptv-org/epg
synced 2026-04-28 05:26:59 -04:00
Replaces icon with image
This commit is contained in:
@@ -29,13 +29,13 @@ module.exports = {
|
||||
items.forEach(item => {
|
||||
const $item = cheerio.load(item)
|
||||
const title = parseTitle($item)
|
||||
const icon = parseIcon($item)
|
||||
const image = parseImage($item)
|
||||
const category = parseCategory($item)
|
||||
const start = parseStart($item, date)
|
||||
const duration = parseDuration($item)
|
||||
const stop = start.add(duration, 'ms')
|
||||
|
||||
programs.push({ title, icon, category, start, stop })
|
||||
programs.push({ title, image, category, start, stop })
|
||||
})
|
||||
|
||||
return programs
|
||||
@@ -88,13 +88,13 @@ function parseDuration($item) {
|
||||
return durationParser(duration)
|
||||
}
|
||||
|
||||
function parseIcon($item) {
|
||||
function parseImage($item) {
|
||||
const img = $item('.mainBroadcastCard-imageContent').first().find('img')
|
||||
const value = img.attr('srcset') || img.data('srcset')
|
||||
const obj = value ? srcset.parse(value).find(i => i.width === 128) : {}
|
||||
|
||||
if (obj.url) {
|
||||
obj.url = obj.url.replace('128x180', '960x540');
|
||||
obj.url = obj.url.replace('128x180', '960x540')
|
||||
}
|
||||
|
||||
return obj.url
|
||||
|
||||
@@ -39,7 +39,8 @@ it('can parse response', () => {
|
||||
stop: '2023-11-27T05:30:00.000Z',
|
||||
title: 'Programmes de la nuit',
|
||||
category: 'Autre',
|
||||
icon: 'https://www.programme-tv.net/imgre/fit/~2~program~978eb86d5b99cee0.jpg/960x540/quality/80/programmes-de-la-nuit.jpg'
|
||||
image:
|
||||
'https://www.programme-tv.net/imgre/fit/~2~program~978eb86d5b99cee0.jpg/960x540/quality/80/programmes-de-la-nuit.jpg'
|
||||
})
|
||||
|
||||
expect(results[27]).toMatchObject({
|
||||
@@ -47,7 +48,8 @@ it('can parse response', () => {
|
||||
stop: '2023-11-27T23:45:00.000Z',
|
||||
title: 'Coup de foudre chez le Père Noël',
|
||||
category: 'Téléfilm',
|
||||
icon: 'https://www.programme-tv.net/imgre/fit/~2~program~5a4e78779c4a3fac.jpg/960x540/quality/80/coup-de-foudre-chez-le-pere-noel.jpg'
|
||||
image:
|
||||
'https://www.programme-tv.net/imgre/fit/~2~program~5a4e78779c4a3fac.jpg/960x540/quality/80/coup-de-foudre-chez-le-pere-noel.jpg'
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user