change fixes + change readme
All checks were successful
Build docker container / build (push) Successful in 5m7s
All checks were successful
Build docker container / build (push) Successful in 5m7s
This commit is contained in:
parent
4199210593
commit
8623771537
@ -177,4 +177,6 @@ Sometimes a new version of this image will be bound to the same source commit. T
|
|||||||
- 1.0.42
|
- 1.0.42
|
||||||
[15-01-2025](https://github.com/iptv-org/epg/commit/5958c77c65a652285da64ad8a77d137306ca46d7)
|
[15-01-2025](https://github.com/iptv-org/epg/commit/5958c77c65a652285da64ad8a77d137306ca46d7)
|
||||||
- 1.0.43
|
- 1.0.43
|
||||||
[20-01-2025](https://github.com/iptv-org/epg/commit/7b2cfba7f5d4df8c01ff74a7c26d7695cb750244)
|
[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,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];
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user