From 272f7d079cbac81c9af86b9f210ace8cabc0e98c Mon Sep 17 00:00:00 2001 From: yyamashita Date: Thu, 18 Jun 2026 12:51:55 +0900 Subject: Fix HTML entity leakage in FAD scraper and Pitbar _clone date bug fad-yokohama: replace innerHTML manipulation with Cheerio .clone().text() so that HTML entities (  etc.) are decoded before storing titles. pitbar-nishiogikubo: strip non-numeric suffix from day part of element ID to handle _clone-suffixed IDs that freecalend.com generates after JS renders. Co-Authored-By: Claude Sonnet 4.6 --- app/scrapers/fad-yokohama.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'app/scrapers/fad-yokohama.ts') diff --git a/app/scrapers/fad-yokohama.ts b/app/scrapers/fad-yokohama.ts index f8f7cbc..ddf3fb7 100644 --- a/app/scrapers/fad-yokohama.ts +++ b/app/scrapers/fad-yokohama.ts @@ -71,11 +71,10 @@ function parsePageEvents( const $firstP = $b("p").first(); if (!$firstP.length) continue; - // Get text with
as newlines - const rawHtml = $firstP.html() ?? ""; - const lines = rawHtml - .replace(//gi, "\n") - .replace(/<[^>]+>/g, " ") + // Get text with
as newlines; use Cheerio .text() to decode HTML entities + const $clone = $firstP.clone(); + $clone.find("br").replaceWith("\n"); + const lines = $clone.text() .split("\n") .map((l) => l.replace(/\s+/g, " ").trim()) .filter(Boolean); -- cgit v1.2.3