mirror of
https://github.com/iptv-org/epg
synced 2025-12-16 18:37:01 -05:00
Update allente.no.config.js
lf to crlf
This commit is contained in:
@@ -1,68 +1,68 @@
|
|||||||
const dayjs = require('dayjs')
|
const dayjs = require('dayjs')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
site: 'allente.no',
|
site: 'allente.no',
|
||||||
days: 2,
|
days: 2,
|
||||||
request: {
|
request: {
|
||||||
cache: {
|
cache: {
|
||||||
ttl: 60 * 60 * 1000 // 1 hour
|
ttl: 60 * 60 * 1000 // 1 hour
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
url({ channel, date }) {
|
url({ channel, date }) {
|
||||||
const country = channel.site_id.split('#')[0]
|
const country = channel.site_id.split('#')[0]
|
||||||
return `https://cs-vcb.allente.${country}/epg/events?date=${date.format('YYYY-MM-DD')}`
|
return `https://cs-vcb.allente.${country}/epg/events?date=${date.format('YYYY-MM-DD')}`
|
||||||
},
|
},
|
||||||
parser({ content, channel }) {
|
parser({ content, channel }) {
|
||||||
let programs = []
|
let programs = []
|
||||||
const items = parseItems(content, channel)
|
const items = parseItems(content, channel)
|
||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
if (!item.details) return
|
if (!item.details) return
|
||||||
const start = dayjs(item.time)
|
const start = dayjs(item.time)
|
||||||
const stop = start.add(item.details.duration, 'm')
|
const stop = start.add(item.details.duration, 'm')
|
||||||
programs.push({
|
programs.push({
|
||||||
title: item.title,
|
title: item.title,
|
||||||
category: item.details.categories,
|
category: item.details.categories,
|
||||||
description: item.details.description,
|
description: item.details.description,
|
||||||
image: item.details.image,
|
image: item.details.image,
|
||||||
season: parseSeason(item),
|
season: parseSeason(item),
|
||||||
episode: parseEpisode(item),
|
episode: parseEpisode(item),
|
||||||
start,
|
start,
|
||||||
stop
|
stop
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
return programs
|
return programs
|
||||||
},
|
},
|
||||||
async channels({ country }) {
|
async channels({ country }) {
|
||||||
const axios = require('axios')
|
const axios = require('axios')
|
||||||
const date = dayjs().format('YYYY-MM-DD')
|
const date = dayjs().format('YYYY-MM-DD')
|
||||||
|
|
||||||
const res = await axios.get(`https://cs-vcb.allente.${country}/epg/events?date=${date}`)
|
const res = await axios.get(`https://cs-vcb.allente.${country}/epg/events?date=${date}`)
|
||||||
const data = res.data
|
const data = res.data
|
||||||
if (!data || !Array.isArray(data.channels)) return []
|
if (!data || !Array.isArray(data.channels)) return []
|
||||||
|
|
||||||
const lang = country === 'dk' ? 'da' : country
|
const lang = country === 'dk' ? 'da' : country
|
||||||
|
|
||||||
return data.channels.map(item => ({
|
return data.channels.map(item => ({
|
||||||
lang: lang,
|
lang: lang,
|
||||||
site_id: `${country}#${item.id}`,
|
site_id: `${country}#${item.id}`,
|
||||||
name: item.name
|
name: item.name
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseItems(content, channel) {
|
function parseItems(content, channel) {
|
||||||
const data = JSON.parse(content)
|
const data = JSON.parse(content)
|
||||||
if (!data || !Array.isArray(data.channels)) return []
|
if (!data || !Array.isArray(data.channels)) return []
|
||||||
const channelId = (channel.site_id || '').split('#')[1] || channel.site_id
|
const channelId = (channel.site_id || '').split('#')[1] || channel.site_id
|
||||||
const channelData = data.channels.find(i => i.id === channelId)
|
const channelData = data.channels.find(i => i.id === channelId)
|
||||||
|
|
||||||
return channelData && Array.isArray(channelData.events) ? channelData.events : []
|
return channelData && Array.isArray(channelData.events) ? channelData.events : []
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseSeason(item) {
|
function parseSeason(item) {
|
||||||
return item.details.season || null
|
return item.details.season || null
|
||||||
}
|
}
|
||||||
function parseEpisode(item) {
|
function parseEpisode(item) {
|
||||||
return item.details.episode || null
|
return item.details.episode || null
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user