#!/usr/bin/env bun import { searches } from "../config.ts"; import { fetchJobs, SOFTWARE_TITLE_RE } from "../fetch.ts"; const CSV = "./results/jobs.csv"; const BASEL_LABELS = new Set(["Basel (city)", "Basel Metropolitan Area", "Basel-Country"]); const existingIds = new Set(); try { const text = await Bun.file(CSV).text(); for (const line of text.split("\n").slice(1)) { const id = line.match(/\/jobs\/view\/(\d+)\//)?.[1]; if (id) existingIds.add(id); } } catch { /* first run */ } const missed: { title: string; company: string; link: string }[] = []; const seenIds = new Set(); for (const config of searches.filter((s) => BASEL_LABELS.has(s.label))) { console.log(`\n[${config.label}]`); const all = await fetchJobs(config, { raw: true }); for (const job of all) { if (!seenIds.has(job.id) && !existingIds.has(job.id) && !SOFTWARE_TITLE_RE.test(job.title)) { seenIds.add(job.id); missed.push({ title: job.title, company: job.company, link: job.link }); } } } if (missed.length === 0) { console.log("\nNo missed jobs — all new titles pass the filter."); process.exit(0); } console.log(`\n── ${missed.length} new Basel-area jobs currently filtered out ──\n`); for (const j of missed) { console.log(` ${j.title}`); console.log(` ${j.company} ${j.link}`); }