import { readFileSync } from "node:fs"; import { KEYWORDS } from "../config.ts"; import { fetchJobs, isEnglishContent } from "../fetch.ts"; import type { SearchConfig } from "../config.ts"; // Load already-seen job IDs from the CSV to show only NEW jobs. const csv = readFileSync("results/jobs.csv", "utf8"); const seen = new Set(); for (const m of csv.matchAll(/jobs\/view\/(\d+)/g)) seen.add(m[1]); const config: SearchConfig = { label: "Switzerland Remote", keywords: KEYWORDS, location: "Switzerland", workType: ["remote"], timePosted: "month", }; const fresh = new Map(); const jobs = await fetchJobs(config); for (const j of jobs) { const id = j.link.match(/jobs\/view\/(\d+)/)?.[1]; if (!id || seen.has(id) || fresh.has(id)) continue; fresh.set(id, j); } console.log(`\n${fresh.size} candidate new jobs, checking English content...\n`); for (const [id, j] of fresh) { const ok = await isEnglishContent(id); if (!ok) continue; console.log(`${id}\t${j.title}\t${j.company}`); }