2025-09-28 17:55:05 +03:00
|
|
|
const dayjs = require('dayjs')
|
|
|
|
|
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
|
|
|
|
|
|
|
|
|
dayjs.extend(customParseFormat)
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
|
site: 'tvplus.com.tr',
|
|
|
|
|
days: 2,
|
2026-04-19 07:25:54 +03:00
|
|
|
url: 'https://izmaottvsc14.tvplus.com.tr:33207/EPG/JSON/PlayBillList',
|
2025-09-28 17:55:05 +03:00
|
|
|
request: {
|
2026-04-19 07:25:54 +03:00
|
|
|
method: 'POST',
|
|
|
|
|
headers: {
|
|
|
|
|
cookie: 'JSESSIONID=05DH3LSUA0W04YMLSYEWK3TRYY1QMBMY;'
|
|
|
|
|
},
|
|
|
|
|
data({ channel, date }) {
|
|
|
|
|
return {
|
|
|
|
|
type: '2',
|
|
|
|
|
channelid: channel.site_id,
|
|
|
|
|
begintime: date.format('YYYYMMDDHHmmss'),
|
|
|
|
|
endtime: date.add(1, 'd').format('YYYYMMDDHHmmss'),
|
|
|
|
|
isFillProgram: 1
|
|
|
|
|
}
|
|
|
|
|
},
|
2025-09-28 17:55:05 +03:00
|
|
|
cache: {
|
|
|
|
|
ttl: 24 * 60 * 60 * 1000 // 1 day
|
|
|
|
|
}
|
|
|
|
|
},
|
2026-04-19 07:25:54 +03:00
|
|
|
parser({ content }) {
|
2025-09-28 17:55:05 +03:00
|
|
|
const programs = []
|
|
|
|
|
|
2026-04-19 07:25:54 +03:00
|
|
|
const items = parseItems(content)
|
2025-09-28 17:55:05 +03:00
|
|
|
|
2026-04-19 07:25:54 +03:00
|
|
|
items.forEach(schedule => {
|
|
|
|
|
programs.push({
|
|
|
|
|
title: schedule.name,
|
|
|
|
|
description: schedule.introduce,
|
|
|
|
|
category: schedule.genres,
|
|
|
|
|
icon: parseIcon(schedule),
|
|
|
|
|
image: parseImage(schedule),
|
|
|
|
|
start: parseTime(schedule.starttime),
|
|
|
|
|
stop: parseTime(schedule.endtime)
|
2025-09-28 17:55:05 +03:00
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
2026-04-19 07:25:54 +03:00
|
|
|
return programs
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-09-28 17:55:05 +03:00
|
|
|
|
2026-04-19 07:25:54 +03:00
|
|
|
function parseTime(time) {
|
|
|
|
|
return dayjs(time, 'YYYY-MM-DD HH:mm:ss [UTC]Z')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function parseImage(schedule) {
|
|
|
|
|
return schedule?.picture?.still || null
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function parseIcon(schedule) {
|
|
|
|
|
if (typeof schedule?.picture?.icon !== 'string') return null
|
|
|
|
|
|
|
|
|
|
return schedule.picture.icon.split(',')[0]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function parseItems(content) {
|
|
|
|
|
try {
|
|
|
|
|
const data = JSON.parse(content)
|
|
|
|
|
if (!data || !Array.isArray(data.playbilllist)) return []
|
|
|
|
|
|
|
|
|
|
return data.playbilllist
|
|
|
|
|
} catch {
|
|
|
|
|
return []
|
2025-09-28 17:55:05 +03:00
|
|
|
}
|
|
|
|
|
}
|