mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Update dstv.com.config.js
This commit is contained in:
parent
8483b6e9f5
commit
e4446a0900
1 changed files with 7 additions and 4 deletions
|
@ -8,10 +8,11 @@ module.exports = {
|
|||
site: 'dstv.com',
|
||||
url: function ({ channel, date }) {
|
||||
const [region] = channel.site_id.split('#')
|
||||
const packageName = region === 'nga' ? 'DStv%20Premium' : ''
|
||||
|
||||
return `https://www.dstv.com/umbraco/api/TvGuide/GetProgrammes?d=${date.format(
|
||||
'YYYY-MM-DD'
|
||||
)}&country=${region}`
|
||||
)}&package=${packageName}&country=${region}`
|
||||
},
|
||||
async parser({ content, channel }) {
|
||||
let programs = []
|
||||
|
@ -32,13 +33,15 @@ module.exports = {
|
|||
},
|
||||
async channels({ country }) {
|
||||
const data = await axios
|
||||
.get(`https://www.dstv.com/umbraco/api/TvGuide/GetChannels?country=${country}`)
|
||||
.get(
|
||||
`https://www.dstv.com/umbraco/api/TvGuide/GetProgrammes?d=2022-03-10&package=DStv%20Premium&country=${country}`
|
||||
)
|
||||
.then(r => r.data)
|
||||
.catch(console.log)
|
||||
|
||||
return data.Channels.map(item => {
|
||||
return {
|
||||
site_id: `${country}#${item.Tag}`,
|
||||
site_id: `${country}#${item.Number}`,
|
||||
name: item.Name
|
||||
}
|
||||
})
|
||||
|
@ -66,7 +69,7 @@ function parseItems(content, channel) {
|
|||
const [_, channelId] = channel.site_id.split('#')
|
||||
const data = JSON.parse(content)
|
||||
if (!data || !Array.isArray(data.Channels)) return []
|
||||
const channelData = data.Channels.find(c => c.Tag === channelId)
|
||||
const channelData = data.Channels.find(c => c.Number === channelId)
|
||||
if (!channelData || !Array.isArray(channelData.Programmes)) return []
|
||||
|
||||
return channelData.Programmes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue