wip
This commit is contained in:
@@ -40,6 +40,7 @@ async function main() {
|
||||
dates.forEach(date => {
|
||||
requests.push({
|
||||
url: site.url({ date, channel }),
|
||||
date,
|
||||
channel
|
||||
})
|
||||
})
|
||||
@@ -54,7 +55,11 @@ async function main() {
|
||||
const site = sites[channel.site]
|
||||
console.log(`${channel.site} - ${channel.xmltv_id}`)
|
||||
|
||||
return site.parser({ channel, content: response.data })
|
||||
return site.parser({
|
||||
channel,
|
||||
content: response.data,
|
||||
date: request.date
|
||||
})
|
||||
})
|
||||
.then(utils.sleep(3000))
|
||||
.catch(console.log)
|
||||
|
||||
@@ -14,17 +14,21 @@ utils.convertToXMLTV = function ({ channels, programs }) {
|
||||
}
|
||||
|
||||
for (let program of programs) {
|
||||
const start = dayjs(program.start).format('YYYYMMDDHHmmss ZZ')
|
||||
const stop = dayjs(program.stop).format('YYYYMMDDHHmmss ZZ')
|
||||
const start = program.start ? dayjs(program.start).format('YYYYMMDDHHmmss ZZ') : null
|
||||
const stop = program.stop ? dayjs(program.stop).format('YYYYMMDDHHmmss ZZ') : null
|
||||
const title = program.title ? program.title.toString().trim().replace('&', '&') : null
|
||||
const lang = program.lang ? program.lang : 'en'
|
||||
|
||||
output += `
|
||||
<programme start="${start}" stop="${stop}" channel="${program.channel}"><title lang="${program.lang}">${program.title}</title>`
|
||||
if (start && title) {
|
||||
output += `
|
||||
<programme start="${start}" stop="${stop}" channel="${program.channel}"><title lang="${lang}">${title}</title>`
|
||||
|
||||
if (program.category) {
|
||||
output += `<category lang="${program.lang}">${program.category}</category>`
|
||||
if (program.category) {
|
||||
output += `<category lang="${lang}">${program.category}</category>`
|
||||
}
|
||||
|
||||
output += '</programme>'
|
||||
}
|
||||
|
||||
output += '</programme>'
|
||||
}
|
||||
|
||||
output += '</tv>'
|
||||
|
||||
Reference in New Issue
Block a user