Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
252a7b23aa | ||
|
0a4d9c4452 | ||
|
6939823646 | ||
|
60503e87ed | ||
|
2f732b6dcc | ||
|
1f999d1c3c | ||
|
3f5b36a878 | ||
|
f1c905f5dd | ||
|
d83069f300 |
@ -52,6 +52,7 @@ RUN apk update \
|
||||
&& mkdir /public
|
||||
COPY start.sh $WORKDIR
|
||||
COPY serve.json $WORKDIR
|
||||
COPY pm2.config.js $WORKDIR
|
||||
RUN chmod +x "$START_SCRIPT" \
|
||||
&& apk del git curl \
|
||||
&& rm -rf /var/cache/apk/*
|
||||
|
18
README.md
18
README.md
@ -193,4 +193,20 @@ Sometimes a new version of this image will be bound to the same source commit. T
|
||||
- 1.0.50
|
||||
[02-05-2025](https://github.com/iptv-org/epg/commit/7f6849869f7182ddfa1a01b08a160ff8d2129441)
|
||||
- 1.0.51
|
||||
[02-11-2025](https://github.com/iptv-org/epg/commit/6cbe64f2dde47a3eb042cac35932989a7eefb2db)
|
||||
[02-11-2025](https://github.com/iptv-org/epg/commit/6cbe64f2dde47a3eb042cac35932989a7eefb2db)
|
||||
- 1.0.52
|
||||
[02-18-2025](https://github.com/iptv-org/epg/commit/39c4c5143e7cf7591ac49227e73e564be70c7615)
|
||||
- 1.0.53
|
||||
[02-23-2025](https://github.com/iptv-org/epg/commit/2721fe1ba06761fd06799a233dda27af6184fd17)
|
||||
- 1.0.54
|
||||
[03-07-2025](https://github.com/iptv-org/epg/commit/40c9af82d6f7f4e562cd239237fdf46a396d5728)
|
||||
- 1.0.55
|
||||
[03-11-2025](https://github.com/iptv-org/epg/commit/40c9af82d6f7f4e562cd239237fdf46a396d5728)
|
||||
- 1.0.56
|
||||
[03-16-2025](https://github.com/iptv-org/epg/commit/cf82b4089ef00c1fc94b7751652bfa598f8ab06a)
|
||||
- 1.0.57
|
||||
[03-25-2025](https://github.com/iptv-org/epg/commit/138842009bb3f9135430cdc667502ffa51d4a295)
|
||||
- 1.0.58
|
||||
[04-04-2025](https://github.com/iptv-org/epg/commit/4df25c92bcad1e4892640f532eae71cf9f5e7b95)
|
||||
- 1.0.59
|
||||
[04-04-2025](https://github.com/iptv-org/epg/commit/4df25c92bcad1e4892640f532eae71cf9f5e7b95)<br>Includes fixes for new configuration changes
|
@ -2,26 +2,17 @@
|
||||
|
||||
const axios = require('axios')
|
||||
const dayjs = require('dayjs')
|
||||
const utc = require('dayjs/plugin/utc')
|
||||
|
||||
let apiVersion
|
||||
|
||||
dayjs.extend(utc)
|
||||
|
||||
module.exports = {
|
||||
site: 'pickx.be',
|
||||
days: 2,
|
||||
setApiVersion: function (version) {
|
||||
apiVersion = version
|
||||
},
|
||||
getApiVersion: function () {
|
||||
return apiVersion
|
||||
},
|
||||
fetchApiVersion: fetchApiVersion,
|
||||
url: async function ({ channel, date }) {
|
||||
async url({ channel, date }) {
|
||||
if (!apiVersion) {
|
||||
await fetchApiVersion()
|
||||
}
|
||||
|
||||
return `https://px-epg.azureedge.net/airings/${apiVersion}/${date.format(
|
||||
'YYYY-MM-DD'
|
||||
)}/channel/${channel.site_id}?timezone=Europe%2FBrussels`
|
||||
@ -51,19 +42,21 @@ module.exports = {
|
||||
episode: item.program.episodeNumber,
|
||||
actors: item.program.actors,
|
||||
director: item.program.director ? [item.program.director] : null,
|
||||
start: dayjs.utc(item.programScheduleStart),
|
||||
stop: dayjs.utc(item.programScheduleEnd)
|
||||
start: dayjs(item.programScheduleStart),
|
||||
stop: dayjs(item.programScheduleEnd)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
return programs
|
||||
},
|
||||
async channels({ lang = '' }) {
|
||||
async channels() {
|
||||
let channels = []
|
||||
|
||||
const query = {
|
||||
operationName: 'getChannels',
|
||||
variables: {
|
||||
language: lang,
|
||||
language: 'fr',
|
||||
queryParams: {},
|
||||
id: '0',
|
||||
params: {
|
||||
@ -71,96 +64,60 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
query: `query getChannels($language: String!, $queryParams: ChannelQueryParams, $id: String, $params: ChannelParams) {
|
||||
channels(language: $language, queryParams: $queryParams, id: $id, params: $params) {
|
||||
id
|
||||
channelReferenceNumber
|
||||
name
|
||||
callLetter
|
||||
number
|
||||
logo {
|
||||
key
|
||||
url
|
||||
__typename
|
||||
}
|
||||
language
|
||||
hd
|
||||
radio
|
||||
replayable
|
||||
ottReplayable
|
||||
playable
|
||||
ottPlayable
|
||||
recordable
|
||||
subscribed
|
||||
cloudRecordable
|
||||
catchUpWindowInHours
|
||||
isOttNPVREnabled
|
||||
ottNPVRStart
|
||||
subscription {
|
||||
channelRef
|
||||
subscribed
|
||||
upselling {
|
||||
upsellable
|
||||
packages
|
||||
__typename
|
||||
}
|
||||
__typename
|
||||
}
|
||||
packages
|
||||
__typename
|
||||
}
|
||||
}`
|
||||
channels(language: $language, queryParams: $queryParams, id: $id, params: $params) {
|
||||
id
|
||||
name
|
||||
language
|
||||
radio
|
||||
}
|
||||
}`
|
||||
}
|
||||
const result = await axios
|
||||
|
||||
const data = await axios
|
||||
.post('https://api.proximusmwc.be/tiams/v3/graphql', query)
|
||||
.then(r => r.data)
|
||||
.catch(console.error)
|
||||
|
||||
return (
|
||||
result?.data?.channels
|
||||
.filter(
|
||||
channel =>
|
||||
!channel.radio && (!lang || channel.language === (lang === 'de' ? 'ger' : lang))
|
||||
)
|
||||
.map(channel => {
|
||||
return {
|
||||
lang: channel.language === 'ger' ? 'de' : channel.language,
|
||||
site_id: channel.id,
|
||||
name: channel.name
|
||||
}
|
||||
}) || []
|
||||
)
|
||||
data.data.channels.forEach(channel => {
|
||||
let lang = channel.language || 'fr'
|
||||
if (channel.language === 'ger') lang = 'de'
|
||||
|
||||
channels.push({
|
||||
lang,
|
||||
site_id: channel.id,
|
||||
name: channel.name
|
||||
})
|
||||
})
|
||||
|
||||
return channels
|
||||
}
|
||||
}
|
||||
function fetchApiVersion() {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
|
||||
async function fetchApiVersion() {
|
||||
const hashUrl = 'https://www.pickx.be/nl/televisie/tv-gids'
|
||||
const hashData = await axios
|
||||
.get(hashUrl)
|
||||
.then(r => {
|
||||
const re = /"hashes":\["(.*)"\]/
|
||||
const match = r.data.match(re)
|
||||
if (match && match[1]) {
|
||||
return match[1]
|
||||
} else {
|
||||
throw new Error('React app version hash not found')
|
||||
}
|
||||
})
|
||||
.catch(console.error)
|
||||
|
||||
const versionUrl = `https://www.pickx.be/api/s-${hashData}`
|
||||
const response = await axios.get(versionUrl, {
|
||||
headers: {
|
||||
Origin: 'https://www.pickx.be',
|
||||
Referer: 'https://www.pickx.be/'
|
||||
}
|
||||
})
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
// 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 hashData = await axios.get(hashUrl)
|
||||
.then(r => {
|
||||
const re = /"hashes":\["(.*)"\]/
|
||||
const match = r.data.match(re)
|
||||
if (match && match[1]) {
|
||||
return match[1]
|
||||
} else {
|
||||
throw new Error('React app version hash not found')
|
||||
}
|
||||
})
|
||||
.catch(console.error);
|
||||
|
||||
const versionUrl = `https://www.pickx.be/api/s-${hashData}`
|
||||
|
||||
const response = await axios.get(versionUrl, {
|
||||
headers: {
|
||||
Origin: 'https://www.pickx.be',
|
||||
Referer: 'https://www.pickx.be/'
|
||||
}
|
||||
})
|
||||
|
||||
if (response.status === 200) {
|
||||
apiVersion = response.data.version
|
||||
resolve()
|
||||
|
23
pm2.config.js
Normal file
23
pm2.config.js
Normal file
@ -0,0 +1,23 @@
|
||||
module.exports = {
|
||||
apps: [
|
||||
{
|
||||
name: 'serve',
|
||||
script: 'npx serve -- public',
|
||||
instances: 1,
|
||||
watch: false,
|
||||
autorestart: true
|
||||
},
|
||||
{
|
||||
name: 'grab',
|
||||
script: process.env.SITE
|
||||
? `npm run grab -- --site=${process.env.SITE} ${
|
||||
process.env.CLANG ? `--lang=${process.env.CLANG}` : ''
|
||||
} --output=public/guide.xml`
|
||||
: `npm run grab -- --gzip --channels=channels.xml --output=public/guide.xml`,
|
||||
cron_restart: process.env.CRON || null,
|
||||
instances: 1,
|
||||
watch: false,
|
||||
autorestart: false
|
||||
}
|
||||
]
|
||||
}
|
7
start.sh
7
start.sh
@ -8,7 +8,7 @@ for arg in "$@"; do
|
||||
days=*) days="${arg#*=}" ;;
|
||||
max_connections=*) max_connections="${arg#*=}" ;;
|
||||
enable_fixes=*) enable_fixes="${arg#*=}" ;;
|
||||
api_url=*) api_url="${arg#*=}" ;;
|
||||
api_url=*) api_url="${arg#*=}" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
@ -25,9 +25,6 @@ if [ "$enable_fixes" = true ] ; then
|
||||
fi
|
||||
|
||||
sed -i -E "s/(https:\x2f\x2fiptv-org.github.io\x2fapi$\123filename\125)/$api_url$\123filename\125/g" $work_dir/scripts/core/apiClient.ts
|
||||
|
||||
pm2 --name epg start npm -- run serve
|
||||
npm run grab --- --channels=channels.xml --maxConnections=$max_connections --days=$days --gzip
|
||||
ln -s $work_dir/guide.xml /public/guide.xml
|
||||
ln -s $work_dir/guide.xml.gz /public/guide.xml.gz
|
||||
npm run grab --- --channels=channels.xml --cron="$chron_schedule" --maxConnections=$max_connections --days=$days --gzip
|
||||
pm2-runtime pm2.config.js --name epg --node-args="--no-autorestart --cron-restart="$chron_schedule" --maxConnections=$max_connections --days=$days"
|
Loading…
x
Reference in New Issue
Block a user