mirror of
https://github.com/iptv-org/epg
synced 2025-12-16 18:37:01 -05:00
Replaces icon with image
This commit is contained in:
@@ -34,7 +34,7 @@ module.exports = {
|
||||
programs.push({
|
||||
title: parseTitle($item),
|
||||
description: parseDescription($item),
|
||||
icon: parseIcon($item),
|
||||
image: parseImage($item),
|
||||
start,
|
||||
stop
|
||||
})
|
||||
@@ -69,13 +69,13 @@ function parseDescription($item) {
|
||||
return $item('.program_about > .program_description > p').text().trim()
|
||||
}
|
||||
|
||||
function parseIcon($item) {
|
||||
function parseImage($item) {
|
||||
const backgroundImage = $item('.program_about > .program_photo').css('background-image')
|
||||
if (!backgroundImage) return null
|
||||
const [, icon] = backgroundImage.match(/url\('(.*)'\)/) || [null, null]
|
||||
if (!icon) return null
|
||||
const [, imageUrl] = backgroundImage.match(/url\('(.*)'\)/) || [null, null]
|
||||
if (!imageUrl) return null
|
||||
|
||||
return `https:${icon}`
|
||||
return `https:${imageUrl}`
|
||||
}
|
||||
|
||||
function parseItems(content) {
|
||||
|
||||
@@ -49,7 +49,8 @@ it('can parse response', () => {
|
||||
title: 'A hegyi doktor - I. évad',
|
||||
description:
|
||||
'Maxl iskolatársának, Vroninak az anyja egy autóbalesetben meghal. A 20 éves testvér, Vinzenz magához szeretné venni a lányt, ám a gyámüggyel problémái akadnak, ezért megpróbálja elszöktetni.(Eredeti hang digitálisan.)',
|
||||
icon: 'https://mediaklikk.hu/wp-content/uploads/sites/4/2019/10/A-hegyi-doktor-I-évad-e1571318391226-150x150.jpg'
|
||||
image:
|
||||
'https://mediaklikk.hu/wp-content/uploads/sites/4/2019/10/A-hegyi-doktor-I-évad-e1571318391226-150x150.jpg'
|
||||
})
|
||||
|
||||
expect(results[56]).toMatchObject({
|
||||
|
||||
Reference in New Issue
Block a user