diff options
Diffstat (limited to 'app/scrapers/fad-yokohama.ts')
| -rw-r--r-- | app/scrapers/fad-yokohama.ts | 9 |
1 files changed, 4 insertions, 5 deletions
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 <br/> as newlines - const rawHtml = $firstP.html() ?? ""; - const lines = rawHtml - .replace(/<br\s*\/?>/gi, "\n") - .replace(/<[^>]+>/g, " ") + // Get text with <br/> 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); |
