From 163634dee31bb94cf5cd0dcf914eb8cb21d7ddea Mon Sep 17 00:00:00 2001 From: dblake10 <162507726+dblake10@users.noreply.github.com> Date: Tue, 24 Feb 2026 16:09:43 -0600 Subject: [PATCH 1/2] Fix tvpassport.com timezone to be dynamic from the content Uses the timezone from the selected timezone of the dropdown on the page, instead of always hardcoding America/New_York. This fixes an offset I was having from pulling the guide from an IP address in the central timezone. --- sites/tvpassport.com/tvpassport.com.config.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/sites/tvpassport.com/tvpassport.com.config.js b/sites/tvpassport.com/tvpassport.com.config.js index b7f98d83..8c462029 100644 --- a/sites/tvpassport.com/tvpassport.com.config.js +++ b/sites/tvpassport.com/tvpassport.com.config.js @@ -29,10 +29,11 @@ module.exports = { }, parser: function ({ content }) { let programs = [] + const currentTimezone = parseCurrentTimezone(content) const items = parseItems(content) for (let item of items) { const $item = cheerio.load(item) - const start = parseStart($item) + const start = parseStart($item, currentTimezone) const duration = parseDuration($item) const stop = start.add(duration, 'm') let title = parseTitle($item) @@ -174,10 +175,10 @@ function parseRating($item) { : null } -function parseStart($item) { +function parseStart($item, currentTimezone) { const time = $item('*').data('st') - return dayjs.tz(time, 'YYYY-MM-DD HH:mm:ss', 'America/New_York') + return dayjs.tz(time, 'YYYY-MM-DD HH:mm:ss', currentTimezone) } function parseDuration($item) { @@ -192,3 +193,10 @@ function parseItems(content) { return $('.station-listings .list-group-item').toArray() } + +function parseCurrentTimezone(content) { + if (!content) return 'America/New_York' + const $ = cheerio.load(content) + + return $('#timezone_selector').val() +} From 5623296b3455dd14a6fced5aed48a1cdf91b9a30 Mon Sep 17 00:00:00 2001 From: dblake10 <162507726+dblake10@users.noreply.github.com> Date: Tue, 24 Feb 2026 18:23:07 -0600 Subject: [PATCH 2/2] tvpassport.com - Added optional chaining on elements that may not exist Added optional chaining on elements that are expected to not exist on the guide listings such as 'episodetitle' and 'year', this fixes the pull for 25 channels that were failing (out of 19,287 channels). --- sites/tvpassport.com/tvpassport.com.config.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sites/tvpassport.com/tvpassport.com.config.js b/sites/tvpassport.com/tvpassport.com.config.js index 8c462029..5a1c0e42 100644 --- a/sites/tvpassport.com/tvpassport.com.config.js +++ b/sites/tvpassport.com/tvpassport.com.config.js @@ -133,11 +133,11 @@ function parseTitle($item) { } function parseSubTitle($item) { - return $item('*').data('episodetitle').toString() || null + return $item('*').data('episodetitle')?.toString() || null } function parseYear($item) { - return $item('*').data('year').toString() || null + return $item('*').data('year')?.toString() || null } function parseCategory($item) { @@ -200,3 +200,4 @@ function parseCurrentTimezone(content) { return $('#timezone_selector').val() } +