Fix tvtv.us issue. adding headers

Fix tvtv.us issue. adding headers
This commit is contained in:
Mauricio300808 2024-11-20 15:41:59 -06:00 committed by GitHub
parent 7610f7b9f5
commit ea02e243c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,17 +8,33 @@ module.exports = {
delay: 1500, // 1500 ms (otherwise the server returns error 429: https://github.com/iptv-org/epg/issues/2176) delay: 1500, // 1500 ms (otherwise the server returns error 429: https://github.com/iptv-org/epg/issues/2176)
days: 2, days: 2,
url: function ({ date, channel }) { url: function ({ date, channel }) {
if (!dayjs.isDayjs(date)) {
throw new Error('Invalid date object passed to url function')
}
return `https://www.tvtv.us/api/v1/lineup/USA-NY71652-X/grid/${date.toJSON()}/${date return `https://www.tvtv.us/api/v1/lineup/USA-NY71652-X/grid/${date.toJSON()}/${date
.add(1, 'd') .add(1, 'day')
.toJSON()}/${channel.site_id}` .toJSON()}/${channel.site_id}`
}, },
request: {
method: 'GET',
headers: {
Accept: '*/*',
Connection: 'keep-alive',
'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36',
'sec-ch-ua': '"Not.A/Brand";v="8", "Chromium";v="114", "Google Chrome";v="114"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"'
}
},
parser: function ({ content }) { parser: function ({ content }) {
let programs = [] let programs = []
const items = parseItems(content) const items = parseItems(content)
items.forEach(item => { items.forEach(item => {
const start = dayjs.utc(item.startTime) const start = dayjs.utc(item.startTime)
const stop = start.add(item.runTime, 'm') const stop = start.add(item.runTime, 'minute')
programs.push({ programs.push({
title: item.title, title: item.title,
description: item.subtitle, description: item.subtitle,