mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Create galamtv.kz.config.js
This commit is contained in:
parent
76df1541d8
commit
6138c472ac
1 changed files with 64 additions and 0 deletions
64
sites/galamtv.kz/galamtv.kz.config.js
Normal file
64
sites/galamtv.kz/galamtv.kz.config.js
Normal file
|
@ -0,0 +1,64 @@
|
|||
const axios = require('axios')
|
||||
const dayjs = require('dayjs')
|
||||
const utc = require('dayjs/plugin/utc')
|
||||
const timezone = require('dayjs/plugin/timezone')
|
||||
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||
|
||||
dayjs.extend(utc)
|
||||
dayjs.extend(timezone)
|
||||
dayjs.extend(customParseFormat)
|
||||
|
||||
module.exports = {
|
||||
site: 'galamtv.kz',
|
||||
timezone: 'Asia/Almaty',
|
||||
days: 2,
|
||||
request: {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Referer: 'https://galamtv.kz/',
|
||||
Origin: 'https://galamtv.kz',
|
||||
Accept: '*/*',
|
||||
'Accept-Encoding': 'gzip, deflate, br, zstd',
|
||||
}
|
||||
},
|
||||
url({ channel, date }) {
|
||||
const todayEpoch = date.startOf('day').unix()
|
||||
const nextDayEpoch = date.add(1, 'day').startOf('day').unix()
|
||||
return `https://galam.server-api.lfstrm.tv/channels/${channel.site_id}/programs?period=${todayEpoch}:${nextDayEpoch}`
|
||||
},
|
||||
parser: function({ content }) {
|
||||
let programs = []
|
||||
const data = JSON.parse(content)
|
||||
const programsData = data.programs || []
|
||||
|
||||
programsData.forEach(program => {
|
||||
const start = dayjs.unix(program.scheduleInfo.start)
|
||||
const stop = dayjs.unix(program.scheduleInfo.end)
|
||||
|
||||
programs.push({
|
||||
title: program.metaInfo.title,
|
||||
description: program.metaInfo.description,
|
||||
image: program.mediaInfo.thumbnails[0].url,
|
||||
start,
|
||||
stop
|
||||
})
|
||||
})
|
||||
|
||||
return programs
|
||||
},
|
||||
async channels() {
|
||||
try {
|
||||
const response = await axios.get(`https://galam.server-api.lfstrm.tv/channels-now`)
|
||||
return response.data.channels.map(item => {
|
||||
return {
|
||||
lang: 'kk',
|
||||
site_id: item.channels.id,
|
||||
name: item.channels.info.metaInfo.title
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('Error fetching channels:', error)
|
||||
return []
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue