Files
linkme/scripts/remote-temp.ts
T
rodado fb67c38edd chore: reorganize repo structure and update docs
- move temp scripts to scripts/, cv files to cv/, jobs.csv to results/
- update index.ts and recheck.ts CSV path to results/jobs.csv
- fix imports in scripts/ to use ../config.ts and ../fetch.ts
- update CLAUDE.md and README.md to reflect new structure
- add plans/ with LinkedIn post drafts
- update .gitignore: ignore results/, jobs/, cv binaries, .DS_Store
2026-06-03 16:01:32 +02:00

71 lines
2.0 KiB
TypeScript

#!/usr/bin/env bun
import { searches, KEYWORDS } from "../config.ts";
import { fetchJobs, isEnglishContent } from "../fetch.ts";
import type { SearchConfig } from "../config.ts";
const CSV = "./jobs.csv";
// Load existing links for deduplication
const existingLinks = new Set<string>();
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 remoteSearches: SearchConfig[] = [
{
label: "Basel (remote)",
keywords: KEYWORDS,
geoId: "103383283",
location: "Basel",
workType: ["remote"],
timePosted: "month",
},
{
label: "Basel Metropolitan Area (remote)",
keywords: KEYWORDS,
geoId: "90009885",
location: "Basel Metropolitan Area",
workType: ["remote"],
timePosted: "month",
},
{
label: "Switzerland (remote)",
keywords: KEYWORDS,
location: "Switzerland",
workType: ["remote"],
timePosted: "month",
},
];
type Job = { id: string; title: string; company: string; link: string; postedAt: string };
const newJobs: Array<Job & { search: string }> = [];
const seenIds = new Set<string>();
for (const config of [...searches, ...remoteSearches]) {
console.log(`\n[${config.label}]`);
const jobs = await fetchJobs(config);
if (jobs.length === 0) { console.log(" No jobs found."); continue; }
let added = 0;
for (const job of jobs) {
if (existingLinks.has(job.link) || seenIds.has(job.id)) continue;
seenIds.add(job.id);
process.stdout.write(` checking: ${job.title} @ ${job.company} … `);
const english = await isEnglishContent(job.id);
if (!english) { console.log("dropped (non-English)"); continue; }
console.log("ok");
newJobs.push({ ...job, search: config.label });
added++;
}
console.log(` ${jobs.length} found, ${added} new`);
}
console.log(`\n=== ${newJobs.length} new jobs total ===\n`);
for (const j of newJobs) {
console.log(`${j.title} | ${j.company} | ${j.search} | ${j.link}`);
}