From b56e79b5b288b7c9e2fef396b303afc32c9baf5d Mon Sep 17 00:00:00 2001 From: yyamashita Date: Sun, 10 May 2026 23:22:17 +0900 Subject: Fix multi-month scrape coverage and add duo MUSIC EXCHANGE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Extend 8 scrapers (liquid-room, shibuya-o, club-quattro, meets-otsuka, nishieifuku-jam, fever-shindaita, fad-yokohama, and new duo-music-exchange) to fetch 3 calendar months instead of 1-2, covering the full 65-day window - Add duo MUSIC EXCHANGE scraper (渋谷, ~700 cap, /schedule/YYYY/index_YYYY-MM.html) - Add npm test: Node.js built-in test runner verifies each scraper fetches all required month URLs via mocked fetch (10 tests, no extra deps) Co-Authored-By: Claude Sonnet 4.6 --- app/scrapers/fad-yokohama.ts | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) (limited to 'app/scrapers/fad-yokohama.ts') diff --git a/app/scrapers/fad-yokohama.ts b/app/scrapers/fad-yokohama.ts index a01ea0d..f8f7cbc 100644 --- a/app/scrapers/fad-yokohama.ts +++ b/app/scrapers/fad-yokohama.ts @@ -151,27 +151,18 @@ function parsePageEvents( export const scraper: Scraper = { venue, async scrape(): Promise { - const res = await fetch(SCHEDULE_URL); - if (!res.ok) throw new Error(`HTTP ${res.status}`); - const html = await res.text(); - - const { year, month, nextUrl } = getMonthContext(html); - const events = parsePageEvents(html, year, month, SCHEDULE_URL); - - if (nextUrl) { - const nextRes = await fetch(nextUrl); - if (nextRes.ok) { - const nextHtml = await nextRes.text(); - let nextMonth = month + 1; - let nextYear = year; - if (nextMonth > 12) { - nextMonth = 1; - nextYear++; - } - events.push(...parsePageEvents(nextHtml, nextYear, nextMonth, nextUrl)); - } + const allEvents: EventInput[] = []; + let url: string | null = SCHEDULE_URL; + + for (let page = 0; page < 3 && url; page++) { + const res = await fetch(url); + if (!res.ok) break; + const html = await res.text(); + const { year, month, nextUrl } = getMonthContext(html); + allEvents.push(...parsePageEvents(html, year, month, url)); + url = nextUrl; } - return events; + return allEvents; }, }; -- cgit v1.2.3