Files
Aut.ManagementFaculty/scripts/parse-faculty-html.mjs
T
smhk1376andCursor de800d27b1 Apply the public site UI checklist.
Align header, footer, brand, homepage course preview, faculty links, and the course catalog with the documented changes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-16 14:05:33 +03:30

25 lines
973 B
JavaScript

import fs from "node:fs";
const html = fs.readFileSync("tmp-faculty.html", "utf8");
const cardRe = /<div class="mstf-card[^"]*"[\s\S]*?<\/div>\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>[^<]*<\/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"><img[^>]+src="([^"]+)"/)?.[1];
console.log({ name, pill, dept, focus, email, phone, linkedin, scholar, img });
}