Update elcinema.com

This commit is contained in:
freearhey
2023-11-19 12:12:42 +03:00
parent 2994c02f31
commit f7342e0f85
4 changed files with 256 additions and 243 deletions

View File

@@ -35,6 +35,30 @@ module.exports = {
})
return programs
},
async channels({ lang }) {
const axios = require('axios')
const data = await axios
.get(`https://elcinema.com/${lang}/tvguide/`)
.then(r => r.data)
.catch(console.log)
const $ = cheerio.load(data)
return $('.tv-line')
.map((i, el) => {
const link = $(el).find('.channel > div > div.hide-for-small-only > a')
const name = $(link).text()
const href = $(link).attr('href')
const [, site_id] = href.match(/\/(\d+)\/$/)
return {
lang,
site_id,
name
}
})
.get()
}
}