import { JUNIOR_TITLE_RE, JAVA_TITLE_RE } from "../fetch.ts"; const TECH_LEAD_KEYWORDS = [ "Tech Lead", "Technical Lead", "Lead Engineer", "Lead Software Engineer", "Lead Developer", "Staff Engineer", "Principal Engineer", "Engineering Manager", "Lead Fullstack", "Lead Backend", "Lead Platform", ].join(" OR "); const HEADERS = { "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36", "Accept-Language": "en-US,en;q=0.9", Accept: "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8", }; function clean(raw: string): string { return raw .replace(/<[^>]+>/g, "") .replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">") .replace(/"/g, '"').replace(/'/g, "'") .replace(/–/g, "–").replace(/—/g, "—") .replace(/\s+/g, " ").trim(); } interface Job { id: string; title: string; company: string; location: string; postedAt: string; link: string; } function parseJobs(html: string): Job[] { const jobs: Job[] = []; const idRe = /data-entity-urn="urn:li:jobPosting:(\d+)"/g; const positions: { id: string; start: number }[] = []; let m; while ((m = idRe.exec(html)) !== null) positions.push({ id: m[1], start: m.index }); for (let i = 0; i < positions.length; i++) { const { id, start } = positions[i]; const card = html.slice(start, Math.min(positions[i + 1]?.start ?? Infinity, start + 3000)); const titleM = card.match(/