Compare commits

..

9 Commits

Author SHA1 Message Date
9c5e4ad69b update readme
All checks were successful
Build docker container / build (push) Successful in 6m12s
2024-11-28 08:14:05 +01:00
8e448d6c57 update readme
All checks were successful
Build docker container / build (push) Successful in 5m21s
2024-11-27 08:36:24 +01:00
31eb8abddf update readme
All checks were successful
Build docker container / build (push) Successful in 4m46s
2024-11-26 13:43:12 +01:00
6acb07ed4e update readme and fix 2024-11-26 13:41:02 +01:00
02133f0692 update custom fix
All checks were successful
Build docker container / build (push) Successful in 4m26s
2024-11-26 13:03:55 +01:00
6543f2ce6c update readme + add option to customize api endpoint
All checks were successful
Build docker container / build (push) Successful in 4m43s
2024-11-26 12:27:04 +01:00
e7b49898df fixes movistar plus
All checks were successful
Build docker container / build (push) Successful in 4m32s
2024-11-22 20:49:52 +01:00
99c7d0e2c6 change custom fix for movistarplus.es
All checks were successful
Build docker container / build (push) Successful in 4m58s
2024-11-22 15:46:57 +01:00
a46995b833 update readme for fixes autor attributions 2024-11-15 13:37:30 +01:00
5 changed files with 131 additions and 83 deletions

View File

@ -2,6 +2,7 @@ FROM node:21-alpine
ARG GIT_REPO=https://github.com/iptv-org/epg.git
ARG GIT_BRANCH=master
ENV CRON_SCHEDULE="0 0,12 * * *"
ENV API_URL="https://iptv-org.github.io/api"
ENV DAYS=14
ENV MAX_CONNECTIONS=10
ENV ENABLE_FIXES=false
@ -49,5 +50,5 @@ RUN chmod +x "$START_SCRIPT" \
&& apk del git curl \
&& rm -rf /var/cache/apk/*
SHELL ["/bin/bash", "-c"]
ENTRYPOINT bash $START_SCRIPT chron-schedule="$CRON_SCHEDULE" work-dir="$WORKDIR" days="$DAYS" max_connections="$MAX_CONNECTIONS" enable_fixes="$ENABLE_FIXES"
ENTRYPOINT bash $START_SCRIPT chron-schedule="$CRON_SCHEDULE" work-dir="$WORKDIR" days="$DAYS" max_connections="$MAX_CONNECTIONS" enable_fixes="$ENABLE_FIXES" api_url="$API_URL"
EXPOSE 3000

View File

@ -32,19 +32,32 @@ You can do this by creating a mapping in the `/config` folder.
#### Custom fixes
Through the `ENABLE_FIXES` variable custom provider fixes can be applied to the container.
By default some fixes are available. If you have suggestions or a problem with them please submit an issue.
By default some fixes are available. These fixes have been validated before being added to this repo.
However this option is disabled by default since you might only want to run the unmodified source.
If you have suggestions or a problem with them please submit an issue.
This the list of the provided custom fixes :
| Provider | Author(s) | Status |
|------------------|------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| movistarplus.es | [davidclaeysquinones](https://github.com/davidclaeysquinones) | [PR](https://github.com/iptv-org/epg/pull/2440) pending approval |
| pickx.be | [davidclaeysquinones](https://github.com/davidclaeysquinones) and [BellezaEmporium](https://github.com/BellezaEmporium) | [PR](https://github.com/iptv-org/epg/pull/2480) pending approval |
| telenet.tv | [davidclaeysquinones](https://github.com/davidclaeysquinones) | [PR](https://github.com/iptv-org/epg/pull/2429) merged since commit [fd382db](https://github.com/iptv-org/epg/commit/fd382db08da7a96150928b8dcfef115e29e661d3) |
| web.magentatv.de | [klausellus-wallace](https://github.com/klausellus-wallace) | [PR](https://github.com/iptv-org/epg/pull/2458) pending approval |
If for some reason you want to include your own provider fixes this is possible by creation a mapping in the `/fixes` folder.<br>
The expected structure is */fixes/`provider_name`/`provider_name`.config.js*.<br>
It is recommended that you take existing provider code as a base for your customisations.
### Environment Variables
| Variable | Description | Default |
|-------------------------------|----------------------------------------------------------------------------|------------------|
| CRON_SCHEDULE | CRON expression describing the recurrence for epg retrieval. | `0 0,12 * * *` |
| DAYS | Describes the desired amount of days in the future for for epg retrieval. | 14 |
| MAX_CONNECTIONS | The maximum amount of parallel connections that can be established | 10 |
| Variable | Description | Default |
|-------------------------------|----------------------------------------------------------------------------|----------------------------------|
| CRON_SCHEDULE | CRON expression describing the recurrence for epg retrieval. | `0 0,12 * * *` |
| DAYS | Describes the desired amount of days in the future for for epg retrieval. | 14 |
| MAX_CONNECTIONS | The maximum amount of parallel connections that can be established | 10 |
| ENABLE_FIXES | Some fixes to providers take a long time to be merged into the main branch.<br>When this option is enabled some of these fixes will also be included.<br>The source code for these fixes can be seen under the `fixes` folder.<br> Recreate the container when changing this variable in order for it to take effect | false |
| API_URL | The endpoint where channel information will be grabbed | `https://iptv-org.github.io/api` |
### Compose file
@ -103,4 +116,16 @@ Sometimes a new version of this image will be bound to the same source commit. T
- 1.0.12
[10-14-2024](https://github.com/iptv-org/epg/commit/7610f7b9f5cc1ccab8d17f3408a95d31b36ace7c)<br>Fix Pickx.be url
- 1.0.13
[10-14-2024](https://github.com/iptv-org/epg/commit/7610f7b9f5cc1ccab8d17f3408a95d31b36ace7c)<br>Add custom fix for web.magentatv.de
[10-14-2024](https://github.com/iptv-org/epg/commit/7610f7b9f5cc1ccab8d17f3408a95d31b36ace7c)<br>Add custom fix for web.magentatv.de
- 1.0.14
[10-14-2024](https://github.com/iptv-org/epg/commit/7610f7b9f5cc1ccab8d17f3408a95d31b36ace7c)<br>Change fix for movistarplus.es in order to work with new API
- 1.0.15
[11-26-2024](https://github.com/iptv-org/epg/commit/d15911006e163262c0c7f267deae28160c0d7a8f)<br>Add option to customize channel endpoint
- 1.0.16
[11-26-2024](https://github.com/iptv-org/epg/commit/d15911006e163262c0c7f267deae28160c0d7a8f)<br>Fix icons for movistarplus.es
- 1.0.17
[11-26-2024](https://github.com/iptv-org/epg/commit/d15911006e163262c0c7f267deae28160c0d7a8f)<br>Update fix for pickx.be
- 1.0.18
[11-27-2024 01:51](https://github.com/iptv-org/epg/commit/78dad4cfb4fc16f078c3b44b5534779c7c645b6b)
- 1.0.19
[11-27-2024 15:43](https://github.com/iptv-org/epg/commit/e5f0850b3b2e35ed394f00ac68b699eaabc4f0e4)

View File

@ -1,76 +1,78 @@
// credit for this fix goes to davidclaeysquinones for his PR on https://github.com/iptv-org/epg/pull/2440
const { DateTime } = require('luxon')
const API_PROD_ENDPOINT = 'https://www.movistarplus.es/programacion-tv'
const API_IMAGE_ENDPOINT = 'https://www.movistarplus.es/recorte/n/caratulaH/';
const API_PROGRAM_ENDPOINT = 'https://comunicacion.movistarplus.es'
const API_IMAGE_ENDPOINT = 'https://www.movistarplus.es/recorte/n/externov';
module.exports = {
site: 'movistarplus.es',
days: 2,
url: function ({ date }) {
return `${API_PROD_ENDPOINT}/${date.format('YYYY-MM-DD')}?v=json`
url: function ({ channel, date }) {
return `${API_PROGRAM_ENDPOINT}/wp-admin/admin-ajax.php`
},
request: {
method: 'POST',
headers: {
Origin: API_PROGRAM_ENDPOINT,
Referer: `${API_PROGRAM_ENDPOINT}/programacion/`,
"Content-Type" : 'application/x-www-form-urlencoded; charset=UTF-8',
},
data: function ({ channel, date }) {
return {
action: 'getProgramation',
day: date.format('YYYY-MM-DD'),
"channels[]": channel.site_id,
};
},
},
parser({ content, channel, date }) {
let programs = []
let items = parseItems(content, channel)
if (!items.length) return programs
let guideDate = date
let items = parseItems(content, channel);
if (!items.length) return programs;
items.forEach(item => {
let startTime = DateTime.fromFormat(
`${guideDate.format('YYYY-MM-DD')} ${item.HORA_INICIO}`,
'yyyy-MM-dd HH:mm',
{
zone: 'Europe/Madrid'
}
).toUTC()
`${item.f_evento_rejilla}`,
'yyyy-MM-dd HH:mm:ss',
{ zone: 'Europe/Madrid' }
).toUTC();
let stopTime = DateTime.fromFormat(
`${guideDate.format('YYYY-MM-DD')} ${item.HORA_FIN}`,
'yyyy-MM-dd HH:mm',
{
zone: 'Europe/Madrid'
}
`${item.f_fin_evento_rejilla}`,
'yyyy-MM-dd HH:mm:ss',
{ zone: 'Europe/Madrid' }
).toUTC()
// Adjust stop time if it's on the next day
if (stopTime < startTime) {
guideDate = guideDate.add(1, 'd')
stopTime = stopTime.plus({ days: 1 })
stopTime = stopTime.plus({ days: 1 });
}
programs.push({
title: item.TITULO,
title: item.des_evento_rejilla,
icon: parseIcon(item, channel),
category: item.GENERO,
category: item.des_genero,
start: startTime,
stop: stopTime
stop: stopTime,
})
})
return programs
},
async channels() {
const axios = require('axios')
const dayjs = require('dayjs')
const data = await axios
.get(`${API_PROD_ENDPOINT}/${dayjs().format('YYYY-MM-DD')}?v=json`)
.then(r => r.data)
.catch(console.log)
return Object.values(data.data).map(item => {
return {
lang: 'es',
site_id: item.DATOS_CADENA.CODIGO,
name: item.DATOS_CADENA.NOMBRE
}
})
}
}
function parseIcon(item, channel) {
return `${API_IMAGE_ENDPOINT}/M${channel.site_id}P${item.ELEMENTO}`;
if(item.cod_elemento_emision)
{
return `${API_IMAGE_ENDPOINT}/M${channel.site_id}P${item.cod_elemento_emision}`
}
return ''
}
function parseItems(content, channel) {
const json = typeof content === 'string' ? JSON.parse(content) : content
if (!(`${channel.site_id}-CODE` in json.data)) return []
const data = json.data[`${channel.site_id}-CODE`]
return data ? data.PROGRAMAS : []
const json = typeof content === 'string' ? JSON.parse(content) : content;
const data = json.channelsProgram;
if (data.length !== 1) return [];
return data[0];
}

View File

@ -1,4 +1,4 @@
// credit for this fix goes to davidclaeysquinones for his PR on https://github.com/iptv-org/epg/pull/2430
// credit for this fix goes to davidclaeysquinones for his PR on https://github.com/iptv-org/epg/pull/2430 and to BellezaEmporium for his PR on https://github.com/iptv-org/epg/pull/2480
const axios = require('axios')
const dayjs = require('dayjs')
@ -141,40 +141,56 @@ module.exports = {
function fetchApiVersion() {
return new Promise(async (resolve, reject) => {
try {
// https://px-epg.azureedge.net/version is deprecated
// probably the version url will be changed around over time
// load pickx bundle and get react version hash (regex).
// it's not the best way to get the version but it's the only way to get it.
//history of used version urls
//const versionUrl = 'https://www.pickx.be/api/s-3b36540f3cef64510112f3f95c2c0cdca321997ed2b1042ad778523235e155eb'
//const versionUrl = 'https://www.pickx.be/api/s-671f172425e1bc74cd0440fd67aaa6cbe68b582f3f401186c2f46ae97e80516b'
//const versionUrl = 'https://www.pickx.be/api/s-a6b4b4fefaa20e438523a6167e63b8504d96b9df8303473349763c4418cffe30'
//const versionUrl = 'https://www.pickx.be/api/s-8546c5fd136241d42aab714d2fe3ccc5671fd899035efae07cd0b8f4eb23994e'
//const versionUrl = 'https://www.pickx.be/api/s-64464ad9a3bc117af5dca620027216ecade6a51c230135a0f134c0ee042ff407';
//const versionUrl = 'https://www.pickx.be/api/s-626d8fdabfb1d44e5a614cd69f4b45d6843fdb63566fc80ea4f97f40e4ea3152';
//const versionUrl = 'https://www.pickx.be/api/s-cefaf96e249e53648c4895c279e7a621233c50b4357d62b0bdf6bff45f31b5c0';
//const versionUrl = 'https://www.pickx.be/api/s-7fa35253080e9665f9c7d9d85e707d6fb1d1bf07ede11965e859fcb57c723949';
//const versionUrl = 'https://www.pickx.be/api/s-0e58be3938175b6b900dfb5233bd5cfc0bcf915b633fe57b935f7ce8dbe5f6eb';
//the new strategy to break the provider is to leave old version url's available and to return invalid results on those endpoints
const versionUrl = 'https://www.pickx.be//api/s-600b22979b1e1e1dc91773795eed4a630dea2f9452aa1aab9a2947f4c89b901d';
const response = await axios.get(versionUrl, {
headers: {
Origin: 'https://www.pickx.be',
Referer: 'https://www.pickx.be/'
}
// find bundle version
const minBundleVer = "https://www.pickx.be/minimal-bundle-version"
const bundleVerData = await axios.get(minBundleVer, {
headers: {
Origin: 'https://www.pickx.be',
Referer: 'https://www.pickx.be/'
}
})
if (response.status === 200) {
apiVersion = response.data.version
resolve()
if (bundleVerData.status !== 200) {
console.error(`Failed to fetch bundle version. Status: ${bundleVerData.status}`)
reject(`Failed to fetch bundle version. Status: ${bundleVerData.status}`)
} else {
console.error(`Failed to fetch API version. Status: ${response.status}`)
reject(`Failed to fetch API version. Status: ${response.status}`)
const bundleVer = bundleVerData.data.version
// get the minified JS app bundle
const bundleUrl = `https://components.pickx.be/pxReactPlayer/${bundleVer}/bundle.min.js`
// now, find the react hash inside the bundle URL
const bundle = await axios.get(bundleUrl).then(r => {
const re = /REACT_APP_VERSION_HASH:"([^"]+)"/
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-${bundle.replace('/REACT_APP_VERSION_HASH:"', '')}`
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()
} else {
console.error(`Failed to fetch API version. Status: ${response.status}`)
reject(`Failed to fetch API version. Status: ${response.status}`)
}
}
} catch (error) {
console.error('Error fetching API version:', error.message)
console.error('Error during fetchApiVersion:', error)
reject(error)
}
})

View File

@ -8,6 +8,7 @@ for arg in "$@"; do
days=*) days="${arg#*=}" ;;
max_connections=*) max_connections="${arg#*=}" ;;
enable_fixes=*) enable_fixes="${arg#*=}" ;;
api_url=*) api_url="${arg#*=}" ;;
esac
done
@ -17,11 +18,14 @@ echo "working dir : " $(pwd)
echo "days : ${days}"
echo "max_connections : ${max_connections}"
echo "enable_fixes : ${enable_fixes}"
echo "api url : ${api_url}"
if [ "$enable_fixes" = true ] ; then
cp -R /fixes/* /bin/epg/sites/
fi
sed -i -E "s/(https:\x2f\x2fiptv-org.github.io\x2fapi)/$api_url/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