mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Update sky.co.nz.config.js
This commit is contained in:
parent
aca2a84a75
commit
47ebf69491
1 changed files with 44 additions and 42 deletions
|
@ -2,52 +2,54 @@ const axios = require('axios')
|
||||||
const dayjs = require('dayjs')
|
const dayjs = require('dayjs')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
site: 'sky.co.nz',
|
site: 'sky.co.nz',
|
||||||
days: 2,
|
days: 2,
|
||||||
url({ date, channel }) {
|
url({ date, channel }) {
|
||||||
return `https://web-epg.sky.co.nz/prod/epgs/v1?channelNumber=${channel.site_id}&start=${date.valueOf()}&end=${date.add(1, 'day').valueOf()}&limit=20000`
|
return `https://web-epg.sky.co.nz/prod/epgs/v1?channelNumber=${
|
||||||
},
|
channel.site_id
|
||||||
parser({ content, channel }) {
|
}&start=${date.valueOf()}&end=${date.add(1, 'day').valueOf()}&limit=20000`
|
||||||
let programs = []
|
},
|
||||||
const items = parseItems(content)
|
parser({ content, channel }) {
|
||||||
items.forEach(item => {
|
let programs = []
|
||||||
programs.push({
|
const items = parseItems(content)
|
||||||
title: item.title,
|
items.forEach(item => {
|
||||||
description: item.synopsis,
|
programs.push({
|
||||||
category: item.genres,
|
title: item.title,
|
||||||
rating: parseRating(item),
|
description: item.synopsis,
|
||||||
start: dayjs(parseInt(item.start)),
|
category: item.genres,
|
||||||
stop: dayjs(parseInt(item.end))
|
rating: parseRating(item),
|
||||||
})
|
start: dayjs(parseInt(item.start)),
|
||||||
})
|
stop: dayjs(parseInt(item.end))
|
||||||
|
|
||||||
return programs
|
|
||||||
},
|
|
||||||
async channels() {
|
|
||||||
const data = await axios
|
|
||||||
.get(`https://skywebconfig.msl-prod.skycloud.co.nz/sky/json/channels.prod.json`)
|
|
||||||
.then(r => r.data)
|
|
||||||
.catch(console.log)
|
|
||||||
|
|
||||||
return data.channels.map(item => {
|
|
||||||
return {
|
|
||||||
lang: 'en',
|
|
||||||
site_id: parseInt(item.number).toString(),
|
|
||||||
name: item.name
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
})
|
||||||
|
|
||||||
|
return programs
|
||||||
|
},
|
||||||
|
async channels() {
|
||||||
|
const data = await axios
|
||||||
|
.get(`https://skywebconfig.msl-prod.skycloud.co.nz/sky/json/channels.prod.json`)
|
||||||
|
.then(r => r.data)
|
||||||
|
.catch(console.log)
|
||||||
|
|
||||||
|
return data.channels.map(item => {
|
||||||
|
return {
|
||||||
|
lang: 'en',
|
||||||
|
site_id: parseInt(item.number).toString(),
|
||||||
|
name: item.name
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseItems(content) {
|
function parseItems(content) {
|
||||||
const data = JSON.parse(content)
|
const data = JSON.parse(content)
|
||||||
return (data && data.events) && Array.isArray(data.events) ? data.events : []
|
return data && data.events && Array.isArray(data.events) ? data.events : []
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseRating(item) {
|
function parseRating(item) {
|
||||||
if (!item.rating) return null
|
if (!item.rating) return null
|
||||||
return {
|
return {
|
||||||
system: 'OFLC',
|
system: 'OFLC',
|
||||||
value: item.rating
|
value: item.rating
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue