Update firstmedia.com channels.

Signed-off-by: Toha <tohenk@yahoo.com>
This commit is contained in:
Toha
2023-11-05 21:14:34 +07:00
parent babd565098
commit cb7aa76810
2 changed files with 52 additions and 123 deletions

View File

@@ -28,6 +28,29 @@ module.exports = {
})
return programs
},
async channels() {
const axios = require('axios')
const cheerio = require('cheerio')
const result = await axios
.get(`https://api.firstmedia.com/api/content/tv-guide/list?date=${dayjs().format('DD/MM/YYYY')}&channel=&startTime=0&endTime=24`)
.then(response => response.data)
.catch(console.error)
const channels = []
if (result.data && result.data.entries) {
Object.values(result.data.entries).forEach(schedules => {
if (schedules.length) {
channels.push({
lang: 'en',
site_id: schedules[0].channel.no,
name: schedules[0].channel.name
})
}
})
}
return channels
}
}