mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 09:00:07 -04:00
Create mako.co.il.config.js
This commit is contained in:
parent
3c95e5e846
commit
185b602e3e
1 changed files with 50 additions and 0 deletions
50
sites/mako.co.il/mako.co.il.config.js
Normal file
50
sites/mako.co.il/mako.co.il.config.js
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
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: 'mako.co.il',
|
||||||
|
url: 'https://www.mako.co.il/AjaxPage?jspName=EPGResponse.jsp',
|
||||||
|
parser: function ({ content, date }) {
|
||||||
|
let programs = []
|
||||||
|
const items = parseItems(content, date)
|
||||||
|
items.forEach(item => {
|
||||||
|
const start = parseStart(item)
|
||||||
|
const stop = start.add(item.DurationMs, 'ms')
|
||||||
|
programs.push({
|
||||||
|
title: item.ProgramName,
|
||||||
|
description: item.EventDescription,
|
||||||
|
icon: item.Picture,
|
||||||
|
start,
|
||||||
|
stop
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
return programs
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseStart(item) {
|
||||||
|
if (!item.StartTimeUTC) return null
|
||||||
|
|
||||||
|
return dayjs(item.StartTimeUTC)
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseStop(item) {
|
||||||
|
if (!item.end_time) return null
|
||||||
|
|
||||||
|
return dayjs.tz(item.end_time, 'YYYY-MM-DDTHH:mm:ss', 'Asia/Jerusalem')
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseItems(content, date) {
|
||||||
|
const data = JSON.parse(content)
|
||||||
|
if (!data || !Array.isArray(data.programs)) return []
|
||||||
|
const d = date.format('DD/MM/YYYY')
|
||||||
|
|
||||||
|
return data.programs.filter(item => item.Date.startsWith(d))
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue