Files
epg/sites/zap2it.com/zap2it.com.config.js

72 lines
2.4 KiB
JavaScript
Raw Normal View History

2025-02-07 22:17:12 -05:00
const dayjs = require('dayjs')
const timezone = require('dayjs/plugin/timezone')
2025-02-08 10:21:28 -05:00
const utc = require('dayjs/plugin/utc')
2025-02-07 22:17:12 -05:00
const isBetween = require('dayjs/plugin/isBetween')
2025-02-08 10:21:28 -05:00
dayjs.extend(timezone)
dayjs.extend(utc)
dayjs.extend(isBetween)
2025-02-07 22:17:12 -05:00
module.exports = {
site: 'zap2it.com',
days: 2,
2025-03-29 13:55:27 -04:00
url: 'https://tvlistings.gracenote.com/api/sslgrid',
2025-02-07 22:17:12 -05:00
request: {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
2025-02-09 19:02:47 -05:00
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36',
2025-02-07 22:17:12 -05:00
},
data({ date, channel }) {
const [device, lineupId, headendId, countryCode, postalCode, prgsvcid] = channel.site_id.split('/')
const timestamp = dayjs(date).unix().toString()
return {
lineupId,
IsSSLinkNavigation: 'true',
timespan: '336',
timestamp,
prgsvcid,
headendId,
countryCode,
postalCode,
device,
userId: '-',
2025-07-31 18:25:00 -04:00
aid: 'orbebb',
2025-02-07 22:17:12 -05:00
DSTUTCOffset: '-240',
STDUTCOffset: '-300',
DSTStart: '2025-03-09T02:00Z',
DSTEnd: '2025-11-02T02:00Z',
languagecode: 'en-us',
2025-02-08 10:21:28 -05:00
}
2025-02-07 22:17:12 -05:00
},
},
parser: function ({ content, date }) {
2025-02-08 10:21:28 -05:00
const data = JSON.parse(content)
const programs = []
2025-02-07 22:17:12 -05:00
Object.keys(data).forEach(dateKey => {
data[dateKey].forEach(item => {
programs.push({
title: item.program.title,
subTitle: item.program.episodeTitle || '',
description: item.program.shortDesc || '',
genres: item.program.genres ? item.program.genres.map(genre => genre.name) : [],
start: dayjs.unix(item.startTime).utc().format('YYYY-MM-DD HH:mm:ss'),
stop: dayjs.unix(item.endTime).utc().format('YYYY-MM-DD HH:mm:ss'),
icon: item.thumbnail ? `https://zap2it.tmsimg.com/assets/${item.thumbnail}.jpg` : '',
rating: item.rating || '',
season: item.program.season || '',
episode: item.program.episode || '',
date: item.program.releaseYear || '',
2025-02-08 10:21:28 -05:00
})
})
})
2025-02-07 22:17:12 -05:00
2025-02-15 17:50:38 -05:00
return programs.filter(p => dayjs(p.start).add(dayjs(p.start).utcOffset(), 'minute').isBetween(date.startOf('day').subtract(dayjs().utcOffset(), 'minute').utc(),
date.endOf('day').subtract(dayjs().utcOffset(), 'minute').utc(), 'second', '[]'))
2025-02-07 22:17:12 -05:00
}
2025-02-08 10:21:28 -05:00
}