mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Update pickx.be.config.js
This commit is contained in:
parent
fb5119bacd
commit
352038fb56
1 changed files with 30 additions and 71 deletions
|
@ -1,25 +1,16 @@
|
||||||
const axios = require('axios')
|
const axios = require('axios')
|
||||||
const dayjs = require('dayjs')
|
const dayjs = require('dayjs')
|
||||||
const utc = require('dayjs/plugin/utc')
|
|
||||||
|
|
||||||
let apiVersion
|
let apiVersion
|
||||||
|
|
||||||
dayjs.extend(utc)
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
site: 'pickx.be',
|
site: 'pickx.be',
|
||||||
days: 2,
|
days: 2,
|
||||||
setApiVersion: function (version) {
|
async url({ channel, date }) {
|
||||||
apiVersion = version
|
|
||||||
},
|
|
||||||
getApiVersion: function () {
|
|
||||||
return apiVersion
|
|
||||||
},
|
|
||||||
fetchApiVersion: fetchApiVersion,
|
|
||||||
url: async function ({ channel, date }) {
|
|
||||||
if (!apiVersion) {
|
if (!apiVersion) {
|
||||||
await fetchApiVersion()
|
await fetchApiVersion()
|
||||||
}
|
}
|
||||||
|
|
||||||
return `https://px-epg.azureedge.net/airings/${apiVersion}/${date.format(
|
return `https://px-epg.azureedge.net/airings/${apiVersion}/${date.format(
|
||||||
'YYYY-MM-DD'
|
'YYYY-MM-DD'
|
||||||
)}/channel/${channel.site_id}?timezone=Europe%2FBrussels`
|
)}/channel/${channel.site_id}?timezone=Europe%2FBrussels`
|
||||||
|
@ -49,19 +40,21 @@ module.exports = {
|
||||||
episode: item.program.episodeNumber,
|
episode: item.program.episodeNumber,
|
||||||
actors: item.program.actors,
|
actors: item.program.actors,
|
||||||
director: item.program.director ? [item.program.director] : null,
|
director: item.program.director ? [item.program.director] : null,
|
||||||
start: dayjs.utc(item.programScheduleStart),
|
start: dayjs(item.programScheduleStart),
|
||||||
stop: dayjs.utc(item.programScheduleEnd)
|
stop: dayjs(item.programScheduleEnd)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return programs
|
return programs
|
||||||
},
|
},
|
||||||
async channels({ lang = '' }) {
|
async channels() {
|
||||||
|
let channels = []
|
||||||
|
|
||||||
const query = {
|
const query = {
|
||||||
operationName: 'getChannels',
|
operationName: 'getChannels',
|
||||||
variables: {
|
variables: {
|
||||||
language: lang,
|
language: 'fr',
|
||||||
queryParams: {},
|
queryParams: {},
|
||||||
id: '0',
|
id: '0',
|
||||||
params: {
|
params: {
|
||||||
|
@ -71,68 +64,34 @@ module.exports = {
|
||||||
query: `query getChannels($language: String!, $queryParams: ChannelQueryParams, $id: String, $params: ChannelParams) {
|
query: `query getChannels($language: String!, $queryParams: ChannelQueryParams, $id: String, $params: ChannelParams) {
|
||||||
channels(language: $language, queryParams: $queryParams, id: $id, params: $params) {
|
channels(language: $language, queryParams: $queryParams, id: $id, params: $params) {
|
||||||
id
|
id
|
||||||
channelReferenceNumber
|
|
||||||
name
|
name
|
||||||
callLetter
|
|
||||||
number
|
|
||||||
logo {
|
|
||||||
key
|
|
||||||
url
|
|
||||||
__typename
|
|
||||||
}
|
|
||||||
language
|
language
|
||||||
hd
|
|
||||||
radio
|
radio
|
||||||
replayable
|
|
||||||
ottReplayable
|
|
||||||
playable
|
|
||||||
ottPlayable
|
|
||||||
recordable
|
|
||||||
subscribed
|
|
||||||
cloudRecordable
|
|
||||||
catchUpWindowInHours
|
|
||||||
isOttNPVREnabled
|
|
||||||
ottNPVRStart
|
|
||||||
subscription {
|
|
||||||
channelRef
|
|
||||||
subscribed
|
|
||||||
upselling {
|
|
||||||
upsellable
|
|
||||||
packages
|
|
||||||
__typename
|
|
||||||
}
|
|
||||||
__typename
|
|
||||||
}
|
|
||||||
packages
|
|
||||||
__typename
|
|
||||||
}
|
}
|
||||||
}`
|
}`
|
||||||
}
|
}
|
||||||
const result = await axios
|
|
||||||
|
const data = await axios
|
||||||
.post('https://api.proximusmwc.be/tiams/v3/graphql', query)
|
.post('https://api.proximusmwc.be/tiams/v3/graphql', query)
|
||||||
.then(r => r.data)
|
.then(r => r.data)
|
||||||
.catch(console.error)
|
.catch(console.error)
|
||||||
|
|
||||||
return (
|
data.data.channels.forEach(channel => {
|
||||||
result?.data?.channels
|
let lang = channel.language || 'fr'
|
||||||
.filter(
|
if (channel.language === 'ger') lang = 'de'
|
||||||
channel =>
|
|
||||||
!channel.radio && (!lang || channel.language === (lang === 'de' ? 'ger' : lang))
|
channels.push({
|
||||||
)
|
lang,
|
||||||
.map(channel => {
|
|
||||||
return {
|
|
||||||
lang: channel.language === 'ger' ? 'de' : channel.language,
|
|
||||||
site_id: channel.id,
|
site_id: channel.id,
|
||||||
name: channel.name
|
name: channel.name
|
||||||
}
|
})
|
||||||
}) || []
|
})
|
||||||
)
|
|
||||||
|
return channels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchApiVersion() {
|
async function fetchApiVersion() {
|
||||||
// you'll never find what happened here :)
|
|
||||||
// load the pickx page and get the hash from the MWC configuration.
|
|
||||||
// it's not the best way to get the version but it's the only way to get it.
|
|
||||||
const hashUrl = 'https://www.pickx.be/nl/televisie/tv-gids'
|
const hashUrl = 'https://www.pickx.be/nl/televisie/tv-gids'
|
||||||
const hashData = await axios
|
const hashData = await axios
|
||||||
.get(hashUrl)
|
.get(hashUrl)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue