mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 09:00:07 -04:00
Create tvim.tv.config.js
This commit is contained in:
parent
0ca068b4c8
commit
cdd0dfb727
1 changed files with 45 additions and 0 deletions
45
sites/tvim.tv/tvim.tv.config.js
Normal file
45
sites/tvim.tv/tvim.tv.config.js
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
const dayjs = require('dayjs')
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
site: 'tvim.tv',
|
||||||
|
url: function ({ date, channel }) {
|
||||||
|
return `https://www.tvim.tv/script/program_epg?date=${date.format('DD.MM.YYYY')}&prog=${
|
||||||
|
channel.site_id
|
||||||
|
}&server_time=true`
|
||||||
|
},
|
||||||
|
logo({ channel }) {
|
||||||
|
return `https://mobile-api.tvim.tv/images/channels/120x60px/${channel.site_id}.png`
|
||||||
|
},
|
||||||
|
parser: function ({ content, channel, date }) {
|
||||||
|
let programs = []
|
||||||
|
const items = parseItems(content)
|
||||||
|
items.forEach(item => {
|
||||||
|
const start = parseStart(item)
|
||||||
|
const stop = parseStop(item)
|
||||||
|
|
||||||
|
programs.push({
|
||||||
|
title: item.title,
|
||||||
|
description: item.desc,
|
||||||
|
category: item.genre,
|
||||||
|
start: start.toString(),
|
||||||
|
stop: stop.toString()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
return programs
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseStart(item) {
|
||||||
|
return dayjs.unix(item.from_utc)
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseStop(item) {
|
||||||
|
return dayjs.unix(item.end_utc)
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseItems(content, channel) {
|
||||||
|
const parsed = JSON.parse(content)
|
||||||
|
|
||||||
|
return parsed.data.prog || []
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue