From fae6d88d6f916c53bdb3d5fabec3d3ac5e02007e Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Wed, 19 Oct 2022 19:16:10 +0300 Subject: [PATCH] Update tvtv.us.config.js --- sites/tvtv.us/tvtv.us.config.js | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/sites/tvtv.us/tvtv.us.config.js b/sites/tvtv.us/tvtv.us.config.js index 6997e4f9..92f2d6a6 100644 --- a/sites/tvtv.us/tvtv.us.config.js +++ b/sites/tvtv.us/tvtv.us.config.js @@ -4,22 +4,25 @@ const utc = require('dayjs/plugin/utc') dayjs.extend(utc) module.exports = { + ignore: true, // NOTE: return an HTTP error 503 (Service Unavailable) on every request from GitHub server only (https://github.com/iptv-org/epg/issues/1172#issuecomment-1284261669) site: 'tvtv.us', url: function ({ date, channel }) { - return `https://www.tvtv.us/api/v1/lineup/USA-NY71652-DEFAULT/grid/${date.toJSON()}/${date.add(1, 'd').toJSON()}/${channel.site_id}` + return `https://www.tvtv.us/api/v1/lineup/USA-NY71652-DEFAULT/grid/${date.toJSON()}/${date + .add(1, 'd') + .toJSON()}/${channel.site_id}` }, 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') - programs.push({ - title: item.title, - description: item.subtitle, - start, - stop + const start = dayjs.utc(item.startTime) + const stop = start.add(item.runTime, 'm') + programs.push({ + title: item.title, + description: item.subtitle, + start, + stop }) }) @@ -27,10 +30,8 @@ module.exports = { } } - function parseItems(content) { - const json = JSON.parse(content) - if (!json.length) return [] - return json[0] + const json = JSON.parse(content) + if (!json.length) return [] + return json[0] } -