Update guidatv.sky.it

This commit is contained in:
freearhey
2023-11-19 16:29:39 +03:00
parent 3e3e4b7ae0
commit 69c527804a
3 changed files with 198 additions and 166 deletions
@@ -29,6 +29,32 @@ module.exports = {
})
return programs
},
async channels() {
const axios = require('axios')
const cheerio = require('cheerio')
const data = await axios
.get(`https://guidatv.sky.it/canali`)
.then(r => r.data)
.catch(console.log)
const $ = cheerio.load(data)
let channels = []
$('.c-channelsCard__container').each((i, el) => {
const name = $(el).find('.c-channelsCard__title').text()
const url = $(el).find('.c-channelsCard__link').attr('href')
const [, channelId] = url.match(/\/(\d+)$/)
channels.push({
lang: 'it',
site_id: `DTH#${channelId}`,
name
})
})
return channels
}
}