mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Update mts.rs
This commit is contained in:
parent
085dbc80ed
commit
13de39aa96
3 changed files with 637 additions and 351 deletions
|
@ -1,3 +1,4 @@
|
|||
const axios = require('axios')
|
||||
const dayjs = require('dayjs')
|
||||
const utc = require('dayjs/plugin/utc')
|
||||
const timezone = require('dayjs/plugin/timezone')
|
||||
|
@ -34,9 +35,50 @@ module.exports = {
|
|||
})
|
||||
|
||||
return programs
|
||||
},
|
||||
async channels() {
|
||||
let channels = []
|
||||
|
||||
const totalPages = await getTotalPageCount()
|
||||
const pages = Array.from(Array(totalPages).keys())
|
||||
for (let page of pages) {
|
||||
const data = await axios
|
||||
.get(`https://mts.rs/oec/epg/program`, {
|
||||
params: { page, date: dayjs().format('YYYY-MM-DD') },
|
||||
headers: {
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
.then(r => r.data)
|
||||
.catch(console.log)
|
||||
|
||||
data.channels.forEach(item => {
|
||||
channels.push({
|
||||
lang: 'bs',
|
||||
site_id: `${item.position}#${item.id}`,
|
||||
name: item.name
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
return channels
|
||||
}
|
||||
}
|
||||
|
||||
async function getTotalPageCount() {
|
||||
const data = await axios
|
||||
.get(`https://mts.rs/oec/epg/program`, {
|
||||
params: { page: 0, date: dayjs().format('YYYY-MM-DD') },
|
||||
headers: {
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
.then(r => r.data)
|
||||
.catch(console.log)
|
||||
|
||||
return data.total_pages
|
||||
}
|
||||
|
||||
function parseContent(content, channel) {
|
||||
const [, site_id] = channel.site_id.split('#')
|
||||
let data
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue