From be55729482296663da8c96723bfd22080e6762c1 Mon Sep 17 00:00:00 2001 From: yyamashita Date: Wed, 6 May 2026 22:07:53 +0900 Subject: Add Tokyo livehouse event aggregator service Full-stack React Router v7 app that scrapes event listings from major Tokyo live venues (Liquid Room, WWW/WWW X, Shibuya O-EAST, Shinjuku LOFT, Club Quattro) and stores them in SQLite for browsing and search. - Modular scraper architecture: add a new venue by dropping a file in app/scrapers/ and registering it in index.ts - Routes: /events (filter by keyword/venue/date), /events/:id, /venues, GET /api/scrape - EventCard shows artist, date/time, venue, ticket URL, and fee - Post-scrape per-venue Markdown files generated to events/ (dev reference) - /add-livehouse Claude Code skill defined in .claude/commands/ Co-Authored-By: Claude Sonnet 4.6 --- app/scrapers/www-shibuya.ts | 79 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 app/scrapers/www-shibuya.ts (limited to 'app/scrapers/www-shibuya.ts') diff --git a/app/scrapers/www-shibuya.ts b/app/scrapers/www-shibuya.ts new file mode 100644 index 0000000..905fc61 --- /dev/null +++ b/app/scrapers/www-shibuya.ts @@ -0,0 +1,79 @@ +/** + * WWW / WWW X (渋谷) — https://www-shibuya.jp/schedule/ + */ +import * as cheerio from "cheerio"; +import type { Scraper, VenueMeta } from "./base"; +import type { EventInput } from "~/lib/db.server"; + +export const venue: VenueMeta = { + id: "www-shibuya", + name: "WWW / WWW X", + url: "https://www-shibuya.jp", + area: "渋谷", +}; + +export const scraper: Scraper = { + venue, + async scrape(): Promise { + const res = await fetch("https://www-shibuya.jp/schedule/"); + if (!res.ok) throw new Error(`HTTP ${res.status}`); + const html = await res.text(); + const $ = cheerio.load(html); + const events: EventInput[] = []; + + $(".schedule-list li, .p-schedule-item, article").each((_, el) => { + const $el = $(el); + + const title = $el.find(".schedule-title, .title, h3, h2").first().text().trim(); + if (!title) return; + + const rawDate = + $el.find(".schedule-date, .date, time").first().text().trim() || + $el.find("time").attr("datetime") || + ""; + const date = parseJapaneseDate(rawDate); + if (!date) return; + + const timeText = $el.find(".schedule-time, .time").first().text(); + const openMatch = timeText.match(/OPEN\s*(\d{2}:\d{2})/i); + const startMatch = timeText.match(/START\s*(\d{2}:\d{2})/i); + + const detailHref = $el.find("a").first().attr("href") ?? null; + + events.push({ + venue_id: venue.id, + title, + artist: $el.find(".artist").first().text().trim() || null, + date, + open_time: openMatch?.[1] ?? null, + start_time: startMatch?.[1] ?? null, + ticket_url: + $el.find("a[href*='eplus'], a[href*='pia'], a[href*='ticket']").first().attr("href") ?? null, + image_url: + $el.find("img").first().attr("src") + ? absoluteUrl($el.find("img").first().attr("src")!, venue.url) + : null, + source_url: detailHref ? absoluteUrl(detailHref, venue.url) : null, + }); + }); + + return events; + }, +}; + +function parseJapaneseDate(raw: string): string | null { + const m = + raw.match(/(\d{4})[./年](\d{1,2})[./月](\d{1,2})/) || + raw.match(/(\d{1,2})[./月](\d{1,2})/); + if (!m) return null; + if (m.length === 4) { + return `${m[1]}-${m[2].padStart(2, "0")}-${m[3].padStart(2, "0")}`; + } + const year = new Date().getFullYear(); + return `${year}-${m[1].padStart(2, "0")}-${m[2].padStart(2, "0")}`; +} + +function absoluteUrl(url: string, base: string): string { + if (url.startsWith("http")) return url; + return url.startsWith("/") ? base + url : `${base}/${url}`; +} -- cgit v1.2.3