mirror of
https://github.com/iptv-org/epg
synced 2025-12-16 18:37:01 -05:00
Update zap2it.com.config.js
This commit is contained in:
@@ -1,71 +1,71 @@
|
|||||||
const dayjs = require('dayjs')
|
const dayjs = require('dayjs')
|
||||||
const timezone = require('dayjs/plugin/timezone')
|
const timezone = require('dayjs/plugin/timezone')
|
||||||
const utc = require('dayjs/plugin/utc')
|
const utc = require('dayjs/plugin/utc')
|
||||||
const isBetween = require('dayjs/plugin/isBetween')
|
const isBetween = require('dayjs/plugin/isBetween')
|
||||||
|
|
||||||
dayjs.extend(timezone)
|
dayjs.extend(timezone)
|
||||||
dayjs.extend(utc)
|
dayjs.extend(utc)
|
||||||
dayjs.extend(isBetween)
|
dayjs.extend(isBetween)
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
site: 'zap2it.com',
|
site: 'zap2it.com',
|
||||||
days: 2,
|
days: 2,
|
||||||
url: 'https://tvlistings.gracenote.com/api/sslgrid',
|
url: 'https://tvlistings.gracenote.com/api/sslgrid',
|
||||||
request: {
|
request: {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
'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',
|
'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',
|
||||||
},
|
},
|
||||||
data({ date, channel }) {
|
data({ date, channel }) {
|
||||||
const [device, lineupId, headendId, countryCode, postalCode, prgsvcid] = channel.site_id.split('/')
|
const [device, lineupId, headendId, countryCode, postalCode, prgsvcid] = channel.site_id.split('/')
|
||||||
|
|
||||||
const timestamp = dayjs(date).unix().toString()
|
const timestamp = dayjs(date).unix().toString()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
lineupId,
|
lineupId,
|
||||||
IsSSLinkNavigation: 'true',
|
IsSSLinkNavigation: 'true',
|
||||||
timespan: '336',
|
timespan: '336',
|
||||||
timestamp,
|
timestamp,
|
||||||
prgsvcid,
|
prgsvcid,
|
||||||
headendId,
|
headendId,
|
||||||
countryCode,
|
countryCode,
|
||||||
postalCode,
|
postalCode,
|
||||||
device,
|
device,
|
||||||
userId: '-',
|
userId: '-',
|
||||||
aid: 'orbebb',
|
aid: 'orbebb',
|
||||||
DSTUTCOffset: '-240',
|
DSTUTCOffset: '-240',
|
||||||
STDUTCOffset: '-300',
|
STDUTCOffset: '-300',
|
||||||
DSTStart: '2025-03-09T02:00Z',
|
DSTStart: '2025-03-09T02:00Z',
|
||||||
DSTEnd: '2025-11-02T02:00Z',
|
DSTEnd: '2025-11-02T02:00Z',
|
||||||
languagecode: 'en-us',
|
languagecode: 'en-us',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
parser: function ({ content, date }) {
|
parser: function ({ content, date }) {
|
||||||
const data = JSON.parse(content)
|
const data = JSON.parse(content)
|
||||||
const programs = []
|
const programs = []
|
||||||
|
|
||||||
Object.keys(data).forEach(dateKey => {
|
Object.keys(data).forEach(dateKey => {
|
||||||
data[dateKey].forEach(item => {
|
data[dateKey].forEach(item => {
|
||||||
programs.push({
|
programs.push({
|
||||||
title: item.program.title,
|
title: item.program.title,
|
||||||
subTitle: item.program.episodeTitle || '',
|
subTitle: item.program.episodeTitle || '',
|
||||||
description: item.program.shortDesc || '',
|
description: item.program.shortDesc || '',
|
||||||
genres: item.program.genres ? item.program.genres.map(genre => genre.name) : [],
|
genres: item.program.genres ? item.program.genres.map(genre => genre.name) : [],
|
||||||
start: dayjs.unix(item.startTime).utc().format('YYYY-MM-DD HH:mm:ss'),
|
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'),
|
stop: dayjs.unix(item.endTime).utc().format('YYYY-MM-DD HH:mm:ss'),
|
||||||
icon: item.thumbnail ? `https://zap2it.tmsimg.com/assets/${item.thumbnail}.jpg` : '',
|
icon: item.thumbnail ? `https://zap2it.tmsimg.com/assets/${item.thumbnail}.jpg` : '',
|
||||||
rating: item.rating || '',
|
rating: item.rating || '',
|
||||||
season: item.program.season || '',
|
season: item.program.season || '',
|
||||||
episode: item.program.episode || '',
|
episode: item.program.episode || '',
|
||||||
date: item.program.releaseYear || '',
|
date: item.program.releaseYear || '',
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
return programs.filter(p => dayjs(p.start).add(dayjs(p.start).utcOffset(), 'minute').isBetween(date.startOf('day').subtract(dayjs().utcOffset(), 'minute').utc(),
|
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', '[]'))
|
date.endOf('day').subtract(dayjs().utcOffset(), 'minute').utc(), 'second', '[]'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user