From ea02e243c6ac92d3f587346643127b4c01b1d054 Mon Sep 17 00:00:00 2001 From: Mauricio300808 <122697066+Mauricio300808@users.noreply.github.com> Date: Wed, 20 Nov 2024 15:41:59 -0600 Subject: [PATCH 1/2] Fix tvtv.us issue. adding headers Fix tvtv.us issue. adding headers --- sites/tvtv.us/tvtv.us.config.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/sites/tvtv.us/tvtv.us.config.js b/sites/tvtv.us/tvtv.us.config.js index 55954435..dec7fb9e 100644 --- a/sites/tvtv.us/tvtv.us.config.js +++ b/sites/tvtv.us/tvtv.us.config.js @@ -1,4 +1,4 @@ -const dayjs = require('dayjs') +const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') dayjs.extend(utc) @@ -8,17 +8,33 @@ module.exports = { delay: 1500, // 1500 ms (otherwise the server returns error 429: https://github.com/iptv-org/epg/issues/2176) days: 2, 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 - .add(1, 'd') + .add(1, 'day') .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 }) { let programs = [] const items = parseItems(content) items.forEach(item => { const start = dayjs.utc(item.startTime) - const stop = start.add(item.runTime, 'm') + const stop = start.add(item.runTime, 'minute') programs.push({ title: item.title, description: item.subtitle, From 61b202e89ad80403ebc7a78ca8b4a226bc1a9113 Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Mon, 25 Nov 2024 18:05:10 +0300 Subject: [PATCH 2/2] Update readme.md --- sites/tvtv.us/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sites/tvtv.us/readme.md b/sites/tvtv.us/readme.md index 60f34fde..7892b33e 100644 --- a/sites/tvtv.us/readme.md +++ b/sites/tvtv.us/readme.md @@ -11,5 +11,5 @@ npm run grab -- --site=tvtv.us ### Test ```sh -npm test -- tvprofil.com +npm test -- tvtv.us ```