Update programme-tv.net

This commit is contained in:
freearhey
2023-11-26 14:27:32 +03:00
parent 5bff0e7662
commit 0ff123b7b1
5 changed files with 7045 additions and 215 deletions

View File

@@ -13,6 +13,11 @@ dayjs.extend(customParseFormat)
module.exports = {
site: 'programme-tv.net',
days: 2,
request: {
headers: {
cookie: 'authId=b7154156fe4fb8acdb6f38e1207c6231'
}
},
url: function ({ date, channel }) {
return `https://www.programme-tv.net/programme/chaine/${date.format('YYYY-MM-DD')}/programme-${
channel.site_id
@@ -34,6 +39,39 @@ module.exports = {
})
return programs
},
async channels() {
const axios = require('axios')
const data = await axios
.get(
`https://www.programme-tv.net/_esi/channel-list/${dayjs().format(
'YYYY-MM-DD'
)}/?bouquet=perso&modal=0`,
{
headers: {
cookie: 'authId=b7154156fe4fb8acdb6f38e1207c6231'
}
}
)
.then(r => r.data)
.catch(console.error)
let channels = []
const $ = cheerio.load(data)
$('.channelList-listItemsLink').each((i, el) => {
const name = $(el).attr('title')
const url = $(el).attr('href')
const [, site_id] = url.match(/\/programme\-(.*)\.html$/i)
channels.push({
lang: 'fr',
site_id,
name
})
})
return channels
}
}
@@ -59,7 +97,7 @@ function parseIcon($item) {
}
function parseCategory($item) {
return $item('.mainBroadcastCard-genre').first().text().trim()
return $item('.mainBroadcastCard-format').first().text().trim()
}
function parseTitle($item) {