import fs from "node:fs"; const html = fs.readFileSync("tmp-faculty.html", "utf8"); const cardRe = /
\s*<\/div>/g; const cards = html.match(cardRe) ?? []; console.log("cards", cards.length); for (const c of cards.slice(0, 3)) { const name = c.match(/mstf-name">([^<]+)/)?.[1]; const pill = c.match(/mstf-pill">([^<]+)/)?.[1]; const dept = c .match(/mstf-dept">([\s\S]*?)<\/div>/)?.[1] ?.replace(/<[^>]+>/g, "") .replace(/\s+/g, " ") .trim(); const focus = c .match(/mstf-int">[^<]*<\/b>\s*([^<]+)/)?.[1] ?.trim(); const email = c.match(/mailto:([^"'\s]+)/)?.[1]; const phone = c.match(/tel:(\+?\d+)/)?.[1]; const linkedin = c.match(/mstf-i-linkedin" href="([^"]+)"/)?.[1]; const scholar = c.match(/mstf-i-scholar" href="([^"]+)"/)?.[1]; const img = c.match(/mstf-avatar">]+src="([^"]+)"/)?.[1]; console.log({ name, pill, dept, focus, email, phone, linkedin, scholar, img }); }