mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Create mbc.net.config.js
This commit is contained in:
parent
602a4d7956
commit
b0835d2612
1 changed files with 42 additions and 0 deletions
42
sites/mbc.net/mbc.net.config.js
Normal file
42
sites/mbc.net/mbc.net.config.js
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
const dayjs = require('dayjs')
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
site: 'mbc.net',
|
||||||
|
url({ date, channel }) {
|
||||||
|
return `https://www.mbc.net/.rest/api/channel/grids?from=${date.valueOf()}&to=${date
|
||||||
|
.add(1, 'd')
|
||||||
|
.valueOf()}&channel=${channel.site_id}`
|
||||||
|
},
|
||||||
|
logo({ channel }) {
|
||||||
|
return channel.logo
|
||||||
|
},
|
||||||
|
parser: function ({ content, channel, date }) {
|
||||||
|
let programs = []
|
||||||
|
const items = parseItems(content)
|
||||||
|
items.forEach(item => {
|
||||||
|
programs.push({
|
||||||
|
title: item.showPageTitle,
|
||||||
|
category: item.showPageGenreInArabic,
|
||||||
|
description: item.showPageAboutInArabic,
|
||||||
|
start: parseStart(item),
|
||||||
|
stop: parseStop(item)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
return programs
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseStart(item) {
|
||||||
|
return dayjs(item.startTime).toJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseStop(item) {
|
||||||
|
return dayjs(item.endTime).toJSON()
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseItems(content) {
|
||||||
|
const data = JSON.parse(content)
|
||||||
|
|
||||||
|
return data
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue