...
let openTime: string | null = null;
let startTime: string | null = null;
$el.find("div.sch-time div").each((_, row) => {
const spans = $(row).find("span");
const label = spans.eq(0).text().trim().toUpperCase();
const value = spans.eq(1).text().trim();
if (label === "OPEN") openTime = value || null;
if (label === "START") startTime = value || null;
});
//
ADV¥2,500
...
const priceParts: string[] = [];
$el.find("div.sch-price div").each((_, row) => {
const spans = $(row).find("span");
const label = spans.eq(0).text().trim();
const value = spans.eq(1).text().trim();
if (label && value) priceParts.push(`${label} ${value}`);
});
const price = priceParts.length ? priceParts.join(" / ") : null;
const imageUrl = $el.find("img.wp-post-image").first().attr("src") ?? null;
const ticketUrl =
$el.find("a[href*='livepocket'], a[href*='eplus'], a[href*='pia'], a[href*='tiget'], a[href*='ticket']")
.first().attr("href") ?? null;
events.push({
venue_id: venue.id,
title,
artist,
date,
open_time: openTime,
start_time: startTime,
price,
ticket_url: ticketUrl,
image_url: imageUrl,
source_url: sourceUrl,
});
});
return events;
},
};