import { fetchJobs, isEnglishContent } from "../fetch.ts"; import type { SearchConfig } from "../config.ts"; const CSV = "./jobs.csv"; const existingLinks = new Set(); try { const text = await Bun.file(CSV).text(); for (const line of text.split("\n").slice(1)) { const url = line.match(/"(https?:\/\/[^"]+)"/)?.[1]; if (url) existingLinks.add(url); } } catch {} const RAILS_KEYWORDS = [ "Ruby on Rails", "Ruby Developer", "Rails Developer", "Ruby Engineer", "Rails Engineer", "Full Stack Ruby", "Backend Ruby", "RoR Developer", "RoR Engineer", ].join(" OR "); const searches: SearchConfig[] = [ { label: "Switzerland Remote Rails (Zürich)", keywords: RAILS_KEYWORDS, geoId: "102436504", location: "Zürich, Switzerland", workType: ["remote"], timePosted: "month", }, { label: "Switzerland Remote Rails (by name)", keywords: RAILS_KEYWORDS, location: "Switzerland", workType: ["remote"], timePosted: "month", }, { label: "Switzerland Remote Rails (Basel)", keywords: RAILS_KEYWORDS, geoId: "103383283", location: "Basel", workType: ["remote"], timePosted: "month", }, ]; type Result = { title: string; company: string; id: string; link: string }; const results: Result[] = []; const seen = new Set(); for (const config of searches) { console.log(`\n[${config.label}]`); const jobs = await fetchJobs(config, { raw: true }); // raw: bypass SOFTWARE_TITLE_RE, we want all Rails hits for (const job of jobs) { if (seen.has(job.id) || existingLinks.has(job.link)) continue; seen.add(job.id); process.stdout.write(` checking content: ${job.title} @ ${job.company} … `); const english = await isEnglishContent(job.id); if (!english) { console.log("dropped (non-English)"); continue; } console.log("ok"); results.push({ title: job.title, company: job.company, id: job.id, link: job.link }); } } console.log(`\n${results.length} new Rails remote jobs found.\n`); for (const r of results) { console.log(`${r.title} | ${r.company} | ${r.link}`); }