mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-09 16:40:07 -04:00
Strip HTML tags in description
This commit is contained in:
parent
16370d2c2e
commit
472f03e981
1 changed files with 30 additions and 4 deletions
|
@ -61,9 +61,9 @@ module.exports = {
|
||||||
title: item.displayNm,
|
title: item.displayNm,
|
||||||
start: parseStart(item),
|
start: parseStart(item),
|
||||||
stop: parseStop(item),
|
stop: parseStop(item),
|
||||||
icon: programDetail ? programDetail.image[0].url : '',
|
icon: parseIcon(programDetail),
|
||||||
category: programDetail ? programDetail.category_Info[0].title : '',
|
category: parseCategory(programDetail),
|
||||||
description: programDetail ? programDetail.content[0].text : ''
|
description: parseDescription(programDetail)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,4 +110,30 @@ async function parseProgramDetail(item) {
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
// console.log(error)
|
// console.log(error)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parseIcon(programDetail) {
|
||||||
|
if (programDetail && programDetail.image && programDetail.image[0].url) {
|
||||||
|
return programDetail.image[0].url
|
||||||
|
} else {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseCategory(programDetail) {
|
||||||
|
if (programDetail && programDetail.category_Info && programDetail.category_Info[0].title) {
|
||||||
|
return programDetail.category_Info[0].title
|
||||||
|
} else {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseDescription(programDetail) {
|
||||||
|
if (programDetail && programDetail.content && programDetail.content[0] && programDetail.content[0].text) {
|
||||||
|
let description = programDetail.content[0].text
|
||||||
|
let regex = /(<([^>]+)>)/ig
|
||||||
|
return description.replace(regex, '')
|
||||||
|
} else {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue