Adds the one-off scripts accumulated across recent sessions, removes temp scripts whose searches now live in config.ts as role-family sweeps, and updates fetch-other.ts plus the LinkedIn post drafts.
30 lines
1.0 KiB
TypeScript
30 lines
1.0 KiB
TypeScript
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<string>();
|
|
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<string, { title: string; company: string; link: string }>();
|
|
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}`);
|
|
}
|