mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Update turksatkablo.com.tr.config.js
This commit is contained in:
parent
4724e9a3a8
commit
ccedaa8b28
1 changed files with 21 additions and 17 deletions
|
@ -9,26 +9,28 @@ dayjs.extend(customParseFormat)
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
site: 'turksatkablo.com.tr',
|
site: 'turksatkablo.com.tr',
|
||||||
ignore: true, // NOTE: server is not stable
|
|
||||||
url: function ({ date }) {
|
url: function ({ date }) {
|
||||||
return `https://www.turksatkablo.com.tr/userUpload/EPG/y.json?_=${date.valueOf()}`
|
return `https://www.turksatkablo.com.tr/userUpload/EPG/y.json?_=${date.valueOf()}`
|
||||||
},
|
},
|
||||||
parser: function ({ content, channel, date }) {
|
parser: function ({ content, channel, date }) {
|
||||||
let PM = false
|
|
||||||
let programs = []
|
let programs = []
|
||||||
const items = parseItems(content, channel)
|
const items = parseItems(content, channel)
|
||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
|
const prev = programs[programs.length - 1]
|
||||||
let start = parseStart(item, date)
|
let start = parseStart(item, date)
|
||||||
if (start.hour() > 11) PM = true
|
if (prev && start.isBefore(prev.start)) {
|
||||||
if (start.hour() < 12 && PM) start = start.add(1, 'd')
|
start = start.add(1, 'd')
|
||||||
|
date = date.add(1, 'd')
|
||||||
|
}
|
||||||
let stop = parseStop(item, date)
|
let stop = parseStop(item, date)
|
||||||
if (stop.hour() > 11) PM = true
|
if (prev && stop.isBefore(start)) {
|
||||||
if (stop.hour() < 12 && PM) stop = stop.add(1, 'd')
|
stop = stop.add(1, 'd')
|
||||||
|
date = date.add(1, 'd')
|
||||||
|
}
|
||||||
programs.push({
|
programs.push({
|
||||||
title: item.b,
|
title: item.b,
|
||||||
start: start.toString(),
|
start,
|
||||||
stop: stop.toString()
|
stop
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -37,22 +39,24 @@ module.exports = {
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseStart(item, date) {
|
function parseStart(item, date) {
|
||||||
const time = `${date.format('MM/DD/YYYY')} ${item.c}`
|
const time = `${date.format('YYYY-MM-DD')} ${item.c}`
|
||||||
|
|
||||||
return dayjs.tz(time, 'MM/DD/YYYY HH:mm', 'Europe/Istanbul')
|
return dayjs.tz(time, 'YYYY-MM-DD HH:mm', 'Europe/Istanbul')
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseStop(item, date) {
|
function parseStop(item, date) {
|
||||||
const time = `${date.format('MM/DD/YYYY')} ${item.d}`
|
const time = `${date.format('YYYY-MM-DD')} ${item.d}`
|
||||||
|
|
||||||
return dayjs.tz(time, 'MM/DD/YYYY HH:mm', 'Europe/Istanbul')
|
return dayjs.tz(time, 'YYYY-MM-DD HH:mm', 'Europe/Istanbul')
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseItems(content, channel) {
|
function parseItems(content, channel) {
|
||||||
const parsed = JSON.parse(content)
|
let parsed
|
||||||
const channels = parsed.k
|
try {
|
||||||
if (!channels) return []
|
parsed = JSON.parse(content)
|
||||||
const data = channels.find(c => c.x == channel.site_id)
|
} catch (e) {}
|
||||||
|
if (!parsed || !parsed.k) return []
|
||||||
|
const data = parsed.k.find(c => c.x == channel.site_id)
|
||||||
|
|
||||||
return data ? data.p : []
|
return data ? data.p : []
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue