mirror of
https://github.com/iptv-org/epg
synced 2026-09-09 21:36:50 -04:00
Update sat.tv
This commit is contained in:
@@ -32,6 +32,9 @@ module.exports = {
|
||||
params.append('userTimezone', 'Europe/London')
|
||||
|
||||
return params
|
||||
},
|
||||
cache: {
|
||||
ttl: 60 * 60 * 1000 // 1h
|
||||
}
|
||||
},
|
||||
parser: function ({ content, date, channel }) {
|
||||
@@ -54,35 +57,76 @@ module.exports = {
|
||||
|
||||
return programs
|
||||
},
|
||||
async channels({ lang, satLineup, satSatellite }) {
|
||||
const params = new URLSearchParams()
|
||||
params.append('dateFiltre', dayjs().format('YYYY-MM-DD'))
|
||||
params.append('hoursFiltre', '0')
|
||||
params.append('satLineup', satLineup)
|
||||
params.append('satSatellite', satSatellite)
|
||||
params.append('userDateTime', dayjs().valueOf())
|
||||
params.append('userTimezone', 'Europe/London')
|
||||
const data = await axios
|
||||
.post(API_ENDPOINT, params, {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
Cookie: `pll_language=${lang}`
|
||||
}
|
||||
async channels({ lang }) {
|
||||
const satellites = [
|
||||
{ satellite: 2, lineup: 55 },
|
||||
{ satellite: 2, lineup: 58 },
|
||||
{ satellite: 2, lineup: 53 },
|
||||
{ satellite: 2, lineup: 57 },
|
||||
{ satellite: 2, lineup: 54 },
|
||||
{ satellite: 2, lineup: 56 },
|
||||
{ satellite: 1, lineup: 48 },
|
||||
{ satellite: 1, lineup: 44 },
|
||||
{ satellite: 1, lineup: 42 },
|
||||
{ satellite: 1, lineup: 39 },
|
||||
{ satellite: 1, lineup: 37 },
|
||||
{ satellite: 1, lineup: 38 },
|
||||
{ satellite: 1, lineup: 68 },
|
||||
{ satellite: 1, lineup: 47 },
|
||||
{ satellite: 1, lineup: 41 },
|
||||
{ satellite: 1, lineup: 49 },
|
||||
{ satellite: 1, lineup: 46 },
|
||||
{ satellite: 1, lineup: 35 },
|
||||
{ satellite: 1, lineup: 43 },
|
||||
{ satellite: 1, lineup: 45 },
|
||||
{ satellite: 1, lineup: 50 },
|
||||
{ satellite: 1, lineup: 71 },
|
||||
{ satellite: 1, lineup: 40 },
|
||||
{ satellite: 1, lineup: 72 },
|
||||
{ satellite: 1, lineup: 33 },
|
||||
{ satellite: 8, lineup: 62 },
|
||||
{ satellite: 8, lineup: 63 },
|
||||
{ satellite: 8, lineup: 64 },
|
||||
{ satellite: 8, lineup: 65 },
|
||||
{ satellite: 8, lineup: 66 },
|
||||
{ satellite: 8, lineup: 67 }
|
||||
]
|
||||
|
||||
let channels = []
|
||||
for (let sat of satellites) {
|
||||
const params = new URLSearchParams()
|
||||
params.append('dateFiltre', dayjs().format('YYYY-MM-DD'))
|
||||
params.append('hoursFiltre', '0')
|
||||
params.append('satLineup', sat.lineup)
|
||||
params.append('satSatellite', sat.satellite)
|
||||
params.append('userDateTime', dayjs().valueOf())
|
||||
params.append('userTimezone', 'Europe/London')
|
||||
const data = await axios
|
||||
.post(API_ENDPOINT, params, {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
Cookie: `pll_language=${lang}`
|
||||
}
|
||||
})
|
||||
.then(r => r.data)
|
||||
.catch(console.log)
|
||||
|
||||
const $ = cheerio.load(data)
|
||||
$('.main-container-channels-events > .container-channel-events').each((i, el) => {
|
||||
const name = $(el).find('.channel-title').text().trim()
|
||||
const channelId = name.replace(/\s\&\s/gi, ' & ')
|
||||
|
||||
if (!name) return
|
||||
|
||||
channels.push({
|
||||
lang,
|
||||
site_id: `${sat.satellite}#${sat.lineup}#${channelId}`,
|
||||
name
|
||||
})
|
||||
})
|
||||
.then(r => r.data)
|
||||
.catch(console.log)
|
||||
}
|
||||
|
||||
const $ = cheerio.load(data)
|
||||
const channels = $('.main-container-channels-events > .container-channel-events').toArray()
|
||||
|
||||
return channels.map(item => {
|
||||
const name = $(item).find('.channel-title').text().trim()
|
||||
return {
|
||||
lang,
|
||||
site_id: name,
|
||||
name
|
||||
}
|
||||
})
|
||||
return channels
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user