Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
645569dc97 | |||
113b6b678e | |||
512d8257fd | |||
db7680861e | |||
8623771537 | |||
4199210593 | |||
3c9432d1f3 | |||
fa76db456f | |||
b434ce505b | |||
2d3ffcbd42 | |||
c4c0bf5270 | |||
8736114213 |
24
README.md
24
README.md
@ -165,4 +165,26 @@ Sometimes a new version of this image will be bound to the same source commit. T
|
|||||||
- 1.0.36
|
- 1.0.36
|
||||||
[12-31-2024 17:32](https://github.com/iptv-org/epg/commit/5ffe285c1e5882e905c5aaee672849f6f89e5cf3)
|
[12-31-2024 17:32](https://github.com/iptv-org/epg/commit/5ffe285c1e5882e905c5aaee672849f6f89e5cf3)
|
||||||
- 1.0.37
|
- 1.0.37
|
||||||
[09-01-2025](https://github.com/iptv-org/epg/commit/8e39af2a4d7c15f442a3e686144278e97151d46e)
|
[09-01-2025](https://github.com/iptv-org/epg/commit/8e39af2a4d7c15f442a3e686144278e97151d46e)
|
||||||
|
- 1.0.38
|
||||||
|
[13-01-2025](https://github.com/iptv-org/epg/commit/9a565f16f4016e49d17b762477e0f6d29bb0f970)
|
||||||
|
- 1.0.39
|
||||||
|
[14-01-2025](https://github.com/iptv-org/epg/commit/76df1541d8b0b90533ea74dcbb7815c27425b608)
|
||||||
|
- 1.0.40
|
||||||
|
[14-01-2025](https://github.com/iptv-org/epg/commit/76df1541d8b0b90533ea74dcbb7815c27425b608)<br> Fixes issue with api url
|
||||||
|
- 1.0.41
|
||||||
|
[15-01-2025](https://github.com/iptv-org/epg/commit/65331dff1c6728c3012e314e51d40da85d2d7f3c)
|
||||||
|
- 1.0.42
|
||||||
|
[15-01-2025](https://github.com/iptv-org/epg/commit/5958c77c65a652285da64ad8a77d137306ca46d7)
|
||||||
|
- 1.0.43
|
||||||
|
[20-01-2025](https://github.com/iptv-org/epg/commit/7b2cfba7f5d4df8c01ff74a7c26d7695cb750244)
|
||||||
|
- 1.0.44
|
||||||
|
[21-01-2025](https://github.com/iptv-org/epg/commit/b69d61af5e46cea4f7dcb15a00d897397c23defa)
|
||||||
|
- 1.0.45
|
||||||
|
[23-01-2025](https://github.com/iptv-org/epg/commit/bc4b7fcfd51325cc597ccce13821f355dd0fbc72)
|
||||||
|
- 1.0.46
|
||||||
|
[27-01-2025](https://github.com/iptv-org/epg/commit/a45a346ec83cae3863b8d0e1cbe7abd99d6fef36)
|
||||||
|
- 1.0.47
|
||||||
|
[29-01-2025](https://github.com/iptv-org/epg/commit/106ae083d243df825958dcf4fea1d48d2765cf72)
|
||||||
|
- 1.0.48
|
||||||
|
[30-01-2025](https://github.com/iptv-org/epg/commit/e57dfaff41f498ffbfe79ecadd37f7f254dad0cc)
|
@ -1,107 +1,60 @@
|
|||||||
const { DateTime } = require('luxon')
|
const axios = require('axios')
|
||||||
|
const cheerio = require('cheerio')
|
||||||
const API_PROGRAM_ENDPOINT = 'https://comunicacion.movistarplus.es'
|
const dayjs = require('dayjs')
|
||||||
const API_IMAGE_ENDPOINT = 'https://www.movistarplus.es/recorte/n/externov';
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
site: 'movistarplus.es',
|
site: 'movistarplus.es',
|
||||||
days: 2,
|
days: 2,
|
||||||
url: function ({ channel, date }) {
|
url({ channel, date }) {
|
||||||
return `${API_PROGRAM_ENDPOINT}/wp-admin/admin-ajax.php`
|
return `https://www.movistarplus.es/programacion-tv/${channel.site_id}/${date.format(
|
||||||
|
'YYYY-MM-DD'
|
||||||
|
)}`
|
||||||
},
|
},
|
||||||
request: {
|
parser({ content }) {
|
||||||
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 programs = []
|
||||||
let items = parseItems(content, channel);
|
let items = parseItems(content)
|
||||||
if (!items.length) return programs;
|
if (!items.length) return programs
|
||||||
|
items.forEach(el => {
|
||||||
items.forEach(item => {
|
|
||||||
let startTime = DateTime.fromFormat(
|
|
||||||
`${item.f_evento_rejilla}`,
|
|
||||||
'yyyy-MM-dd HH:mm:ss',
|
|
||||||
{ zone: 'Europe/Madrid' }
|
|
||||||
).toUTC();
|
|
||||||
|
|
||||||
let stopTime = DateTime.fromFormat(
|
|
||||||
`${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) {
|
|
||||||
stopTime = stopTime.plus({ days: 1 });
|
|
||||||
}
|
|
||||||
|
|
||||||
programs.push({
|
programs.push({
|
||||||
title: item.des_evento_rejilla,
|
title: el.item.name,
|
||||||
icon: parseIcon(item, channel),
|
start: dayjs(el.item.startDate),
|
||||||
category: item.des_genero,
|
stop: dayjs(el.item.endDate)
|
||||||
start: startTime,
|
|
||||||
stop: stopTime,
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
return programs
|
return programs
|
||||||
},
|
},
|
||||||
async channels() {
|
async channels() {
|
||||||
const axios = require('axios')
|
const html = await axios
|
||||||
//const dayjs = require('dayjs')
|
.get('https://www.movistarplus.es/programacion-tv')
|
||||||
const data = await axios
|
|
||||||
.post(`${API_PROGRAM_ENDPOINT}/wp-admin/admin-ajax.php`,
|
|
||||||
{
|
|
||||||
action: 'getChannels',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
Origin: API_PROGRAM_ENDPOINT,
|
|
||||||
Referer: `${API_PROGRAM_ENDPOINT}/programacion/`,
|
|
||||||
"Content-Type" : 'application/x-www-form-urlencoded; charset=UTF-8',
|
|
||||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36 Edg/79.0.309.71'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.then(r => r.data)
|
.then(r => r.data)
|
||||||
.catch(console.log)
|
.catch(console.log)
|
||||||
|
|
||||||
return Object.values(data).map(item => {
|
const $ = cheerio.load(html)
|
||||||
|
let scheme = $('script:contains(ItemList)').html()
|
||||||
|
scheme = JSON.parse(scheme)
|
||||||
|
|
||||||
|
return scheme.itemListElement.map(el => {
|
||||||
|
const urlParts = el.item.url.split('/')
|
||||||
|
const site_id = urlParts.pop().toLowerCase()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
lang: 'es',
|
lang: 'es',
|
||||||
site_id: item.cod_cadena_tv,
|
name: el.item.name,
|
||||||
name: item.des_cadena_tv
|
site_id
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parseItems(content) {
|
||||||
|
try {
|
||||||
|
const $ = cheerio.load(content)
|
||||||
|
let scheme = $('script:contains("@type": "ItemList")').html()
|
||||||
|
scheme = JSON.parse(scheme)
|
||||||
|
if (!scheme || !Array.isArray(scheme.itemListElement)) return []
|
||||||
|
|
||||||
function parseIcon(item, channel) {
|
return scheme.itemListElement
|
||||||
if(item.cod_elemento_emision)
|
} catch {
|
||||||
{
|
return []
|
||||||
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;
|
|
||||||
const data = json.channelsProgram;
|
|
||||||
|
|
||||||
if (data.length !== 1) return [];
|
|
||||||
return data[0];
|
|
||||||
}
|
}
|
@ -1,11 +1,15 @@
|
|||||||
const dayjs = require('dayjs')
|
const dayjs = require('dayjs')
|
||||||
const utc = require('dayjs/plugin/utc')
|
const utc = require('dayjs/plugin/utc')
|
||||||
const axios = require('axios')
|
const doFetch = require('@ntlab/sfetch')
|
||||||
|
const debug = require('debug')('site:orangetv.orange.es')
|
||||||
|
|
||||||
dayjs.extend(utc)
|
dayjs.extend(utc)
|
||||||
|
|
||||||
|
doFetch.setDebugger(debug)
|
||||||
|
|
||||||
const API_PROGRAM_ENDPOINT = 'https://epg.orangetv.orange.es/epg/Smartphone_Android/1_PRO'
|
const API_PROGRAM_ENDPOINT = 'https://epg.orangetv.orange.es/epg/Smartphone_Android/1_PRO'
|
||||||
const API_CHANNEL_ENDPOINT = 'https://pc.orangetv.orange.es/pc/api/rtv/v1/GetChannelList?bouquet_id=1&model_external_id=PC&filter_unsupported_channels=false&client=json'
|
const API_CHANNEL_ENDPOINT =
|
||||||
|
'https://pc.orangetv.orange.es/pc/api/rtv/v1/GetChannelList?bouquet_id=1&model_external_id=PC&filter_unsupported_channels=false&client=json'
|
||||||
const API_IMAGE_ENDPOINT = 'https://pc.orangetv.orange.es/pc/api/rtv/v1/images'
|
const API_IMAGE_ENDPOINT = 'https://pc.orangetv.orange.es/pc/api/rtv/v1/images'
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@ -13,53 +17,39 @@ module.exports = {
|
|||||||
days: 2,
|
days: 2,
|
||||||
request: {
|
request: {
|
||||||
cache: {
|
cache: {
|
||||||
ttl: 60 * 60 * 1000 // 1 hour
|
ttl: 24 * 60 * 60 * 1000 // 1 day
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
url({ date }) {
|
url({ date, segment = 1 }) {
|
||||||
return `${API_PROGRAM_ENDPOINT}/${date.format('YYYYMMDD')}_8h_1.json`
|
return `${API_PROGRAM_ENDPOINT}/${date.format('YYYYMMDD')}_8h_${segment}.json`
|
||||||
},
|
},
|
||||||
async parser({ content, channel, date }) {
|
async parser({ content, channel, date }) {
|
||||||
let programs = []
|
const programs = []
|
||||||
let items = parseItems(content, channel)
|
const items = parseItems(content, channel)
|
||||||
if (!items.length) return programs
|
if (items.length) {
|
||||||
|
const queues = [
|
||||||
const promises = [
|
module.exports.url({ date, segment: 2 }),
|
||||||
axios.get(
|
module.exports.url({ date, segment: 3 })
|
||||||
`${API_PROGRAM_ENDPOINT}/${date.format('YYYYMMDD')}_8h_1.json`,
|
]
|
||||||
),
|
await doFetch(queues, (url, res) => {
|
||||||
axios.get(
|
items.push(...parseItems(res, channel))
|
||||||
`${API_PROGRAM_ENDPOINT}/${date.format('YYYYMMDD')}_8h_2.json`,
|
})
|
||||||
),
|
programs.push(
|
||||||
axios.get(
|
...items.map(item => {
|
||||||
`${API_PROGRAM_ENDPOINT}/${date.format('YYYYMMDD')}_8h_3.json`,
|
return {
|
||||||
),
|
title: item.name,
|
||||||
]
|
sub_title: item.seriesName,
|
||||||
|
description: item.description,
|
||||||
await Promise.allSettled(promises)
|
category: parseGenres(item),
|
||||||
.then(results => {
|
season: item.seriesSeason ? parseInt(item.seriesSeason) : null,
|
||||||
results.forEach(r => {
|
episode: item.episodeId ? parseInt(item.episodeId) : null,
|
||||||
if (r.status === 'fulfilled') {
|
icon: parseIcon(item),
|
||||||
const parsed = parseItems(r.value.data, channel)
|
start: dayjs.utc(item.startDate),
|
||||||
|
stop: dayjs.utc(item.endDate)
|
||||||
items = items.filter((item, index) => items.findIndex(oi => oi.id === item.id) === index).concat(parsed)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
)
|
||||||
.catch(console.error)
|
}
|
||||||
|
|
||||||
items.forEach(item => {
|
|
||||||
programs.push({
|
|
||||||
title: item.name,
|
|
||||||
description: item.description,
|
|
||||||
category: parseGenres(item),
|
|
||||||
season: item.seriesSeason || null,
|
|
||||||
episode: item.episodeId || null,
|
|
||||||
icon: parseIcon(item),
|
|
||||||
start: dayjs.utc(item.startDate) || null,
|
|
||||||
stop: dayjs.utc(item.endDate) || null,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
return programs
|
return programs
|
||||||
},
|
},
|
||||||
@ -68,46 +58,42 @@ module.exports = {
|
|||||||
const data = await axios
|
const data = await axios
|
||||||
.get(API_CHANNEL_ENDPOINT)
|
.get(API_CHANNEL_ENDPOINT)
|
||||||
.then(r => r.data)
|
.then(r => r.data)
|
||||||
.catch(console.log)
|
.catch(console.error)
|
||||||
|
|
||||||
return data.response.map(item => {
|
return data.response.map(item => {
|
||||||
return {
|
return {
|
||||||
lang: 'es',
|
lang: 'es',
|
||||||
name: item.name,
|
name: item.name,
|
||||||
site_id: item.externalChannelId
|
site_id: item.externalChannelId
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseIcon(item){
|
function parseIcon(item) {
|
||||||
|
if (item.attachments.length) {
|
||||||
if(item.attachments.length > 0){
|
const cover = item.attachments.find(i => i.name.match(/cover/i))
|
||||||
const cover = item.attachments.find(i => i.name === "COVER" || i.name === "cover")
|
if (cover) {
|
||||||
|
return `${API_IMAGE_ENDPOINT}${cover.value}`
|
||||||
if(cover)
|
|
||||||
{
|
|
||||||
return `${API_IMAGE_ENDPOINT}${cover.value}`;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ''
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseGenres(item){
|
function parseGenres(item) {
|
||||||
return item.genres.map(i => i.name);
|
return item.genres.map(i => i.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseItems(content, channel) {
|
function parseItems(content, channel) {
|
||||||
const json = typeof content === 'string' ? JSON.parse(content) : Array.isArray(content) ? content : []
|
const result = []
|
||||||
|
const json =
|
||||||
if (!Array.isArray(json)) {
|
typeof content === 'string' ? JSON.parse(content) : Array.isArray(content) ? content : []
|
||||||
return [];
|
if (Array.isArray(json)) {
|
||||||
|
json
|
||||||
|
.filter(i => i.channelExternalId === channel.site_id)
|
||||||
|
.forEach(i => {
|
||||||
|
result.push(...i.programs)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const channelData = json.find(i => i.channelExternalId == channel.site_id);
|
return result
|
||||||
|
|
||||||
if(!channelData)
|
|
||||||
return [];
|
|
||||||
|
|
||||||
return channelData.programs;
|
|
||||||
}
|
}
|
2
start.sh
2
start.sh
@ -24,7 +24,7 @@ if [ "$enable_fixes" = true ] ; then
|
|||||||
cp -R /fixes/* /bin/epg/sites/
|
cp -R /fixes/* /bin/epg/sites/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sed -i -E "s/(https:\x2f\x2fiptv-org.github.io\x2fapi)/$api_url/g" $work_dir/scripts/core/apiClient.ts
|
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
|
pm2 --name epg start npm -- run serve
|
||||||
npm run grab --- --channels=channels.xml --maxConnections=$max_connections --days=$days --gzip
|
npm run grab --- --channels=channels.xml --maxConnections=$max_connections --days=$days --gzip
|
||||||
|
Reference in New Issue
Block a user