mirror of
https://github.com/iptv-org/epg
synced 2025-12-17 10:56:57 -05:00
Strip HTML tags in description
This commit is contained in:
@@ -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)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,3 +111,29 @@ async function parseProgramDetail(item) {
|
|||||||
// 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 ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user