mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-12 01:50:07 -04:00
Update delta.nl.config.js
This commit is contained in:
parent
9fc3d84dd3
commit
33a21ddfef
1 changed files with 16 additions and 3 deletions
|
@ -8,17 +8,19 @@ module.exports = {
|
||||||
.add(1, 'd')
|
.add(1, 'd')
|
||||||
.unix()}&includeDetails=true&channels=${channel.site_id}`
|
.unix()}&includeDetails=true&channels=${channel.site_id}`
|
||||||
},
|
},
|
||||||
parser: function ({ content, channel }) {
|
async parser({ content, channel }) {
|
||||||
let programs = []
|
let programs = []
|
||||||
const items = parseItems(content, channel)
|
const items = parseItems(content, channel)
|
||||||
items.forEach(item => {
|
for (let item of items) {
|
||||||
|
const details = await loadProgramDetails(item)
|
||||||
programs.push({
|
programs.push({
|
||||||
title: item.title,
|
title: item.title,
|
||||||
icon: item.images.thumbnail.url,
|
icon: item.images.thumbnail.url,
|
||||||
|
description: details.description,
|
||||||
start: parseStart(item).toJSON(),
|
start: parseStart(item).toJSON(),
|
||||||
stop: parseStop(item).toJSON()
|
stop: parseStop(item).toJSON()
|
||||||
})
|
})
|
||||||
})
|
}
|
||||||
|
|
||||||
return programs
|
return programs
|
||||||
},
|
},
|
||||||
|
@ -40,6 +42,17 @@ module.exports = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function loadProgramDetails(item) {
|
||||||
|
if (!item.ID) return {}
|
||||||
|
const url = `https://clientapi.tv.delta.nl/guide/4/details/${item.ID}?X-Response-Version=4.5`
|
||||||
|
const data = await axios
|
||||||
|
.get(url)
|
||||||
|
.then(r => r.data)
|
||||||
|
.catch(console.log)
|
||||||
|
|
||||||
|
return data || {}
|
||||||
|
}
|
||||||
|
|
||||||
function parseStart(item) {
|
function parseStart(item) {
|
||||||
return dayjs.unix(item.start)
|
return dayjs.unix(item.start)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue