From 363de81363f14dd8fbab0e7f73c95dd5035efbf5 Mon Sep 17 00:00:00 2001 From: vault-agent Date: Sun, 30 Aug 2026 18:45:32 -0700 Subject: [PATCH] Implement spec from notes/libowski-bot-fix-vikes-tv.md --- src/commands/view-vikes-tv.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/commands/view-vikes-tv.js b/src/commands/view-vikes-tv.js index 8e82ca9..885ebab 100644 --- a/src/commands/view-vikes-tv.js +++ b/src/commands/view-vikes-tv.js @@ -49,16 +49,17 @@ export class ViewVikesTVCommand extends Command { const html = await response.text(); const $ = cheerio.load(html); const games = []; - - $('div.nfl-o-matchup-cards').each((_, el) => { - const $card = $(el); - const $jsonScript = $card.find('script[type="application/ld+json"]'); + const scriptTags = $('script[type="application/ld+json"]'); + + scriptTags.each((_, el) => { + const $script = $(el); + const $card = $script.closest('div.nfl-o-matchup-cards'); - if ($jsonScript.length === 0) return; + if ($card.length === 0) return; try { - const json = JSON.parse($jsonScript.html()); - if (json["@type"] === "SportsEvent") { + const json = JSON.parse($script.html()); + if (json["@type"] === "SportsEvent" && json.startDate) { const tv = $card.find('.nfl-o-matchup-cards__media-tv--networks').text().trim(); games.push({ ...json, tv: tv || "TBD" }); }