mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 09:00:07 -04:00
Update i.mjh.nz.config.js
This commit is contained in:
parent
541015b901
commit
65e1b5f34c
1 changed files with 22 additions and 1 deletions
|
@ -23,7 +23,16 @@ module.exports = {
|
||||||
return `${API_ENDPOINT}/${path}.xml`
|
return `${API_ENDPOINT}/${path}.xml`
|
||||||
},
|
},
|
||||||
parser: function ({ content, channel, date, cached }) {
|
parser: function ({ content, channel, date, cached }) {
|
||||||
return parseItems(content, channel, date)
|
const items = parseItems(content, channel, date)
|
||||||
|
|
||||||
|
return items.map(item => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
title: getTitle(item),
|
||||||
|
description: getDescription(item),
|
||||||
|
categories: getCategories(item)
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
async channels({ path, lang = 'en' }) {
|
async channels({ path, lang = 'en' }) {
|
||||||
let xml = await axios
|
let xml = await axios
|
||||||
|
@ -42,6 +51,18 @@ module.exports = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getTitle(item) {
|
||||||
|
return item.title.length ? item.title[0].value : null
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDescription(item) {
|
||||||
|
return item.desc.length ? item.desc[0].value : null
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCategories(item) {
|
||||||
|
return item.category.map(c => c.value)
|
||||||
|
}
|
||||||
|
|
||||||
function parseItems(content, channel, date) {
|
function parseItems(content, channel, date) {
|
||||||
try {
|
try {
|
||||||
const curr_day = date
|
const curr_day = date
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue