This commit is contained in:
root 2026-03-12 12:48:18 +11:00
parent 3b0f4992a2
commit b4142df483
1 changed files with 6 additions and 5 deletions

View File

@ -117,11 +117,12 @@ async function scrapeWithPuppeteer(store) {
nodes.forEach((node) => {
const payload = {};
// ---------------- LINK + ID ----------------
const linkEl = node.querySelector("div.su-media__image a");
const linkEl = node.querySelector("div.su-image a");
// if (!linkEl) return;
payload.link_detail = linkEl?.href || "";
const idMatch = linkEl.href.match(/\/itm\/(\d+)/);
const linkDetail = linkEl && linkEl?.href ? linkEl?.href : ""
if (!linkDetail) return;
payload.link_detail = linkDetail;
const idMatch = linkDetail.match(/\/itm\/(\d+)/);
if (!idMatch) return;
payload.id = idMatch[1];