fusion allente configurations into one

This commit is contained in:
theofficialomega
2025-08-17 16:11:44 +02:00
parent 77e10af52c
commit 5d6867fbc1
25 changed files with 357 additions and 767 deletions

View File

@@ -8,8 +8,9 @@ module.exports = {
ttl: 60 * 60 * 1000 // 1 hour
}
},
url({ date }) {
return `https://cs-vcb.allente.no/epg/events?date=${date.format('YYYY-MM-DD')}`
url({ channel, date }) {
const country = channel.site_id.split('#')[0]
return `https://cs-vcb.allente.${country}/epg/events?date=${date.format('YYYY-MM-DD')}`
},
parser({ content, channel }) {
let programs = []
@@ -32,27 +33,27 @@ module.exports = {
return programs
},
async channels() {
async channels({ country = 'no' }) {
const axios = require('axios')
const data = await axios
.get(`https://cs-vcb.allente.no/epg/events?date=${dayjs().format('YYYY-MM-DD')}`)
.then(r => r.data)
.catch(console.log)
const date = dayjs().format('YYYY-MM-DD')
return data.channels.map(item => {
return {
lang: 'no',
site_id: item.id,
name: item.name
}
})
const res = await axios.get(`https://cs-vcb.allente.${country}/epg/events?date=${date}`)
const data = res.data
if (!data || !Array.isArray(data.channels)) return []
return data.channels.map(item => ({
lang: country,
site_id: `${country}#${item.id}`,
name: item.name
}))
}
}
function parseItems(content, channel) {
const data = JSON.parse(content)
if (!data || !Array.isArray(data.channels)) return []
const channelData = data.channels.find(i => i.id === channel.site_id)
const channelId = (channel.site_id || '').split('#')[1] || channel.site_id
const channelData = data.channels.find(i => i.id === channelId)
return channelData && Array.isArray(channelData.events) ? channelData.events : []
}