- 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
72 lines
1.9 KiB
TypeScript
72 lines
1.9 KiB
TypeScript
import { 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 {
|
|
// first run
|
|
}
|
|
|
|
const searches: SearchConfig[] = [
|
|
{
|
|
label: "Switzerland Remote (Basel geoId)",
|
|
keywords: KEYWORDS,
|
|
geoId: "103383283",
|
|
location: "Basel",
|
|
workType: ["remote"],
|
|
timePosted: "month",
|
|
},
|
|
{
|
|
label: "Switzerland Remote (Zürich geoId)",
|
|
keywords: KEYWORDS,
|
|
geoId: "102436504",
|
|
location: "Zürich, Switzerland",
|
|
workType: ["remote"],
|
|
timePosted: "month",
|
|
},
|
|
{
|
|
label: "Switzerland Remote (by name)",
|
|
keywords: KEYWORDS,
|
|
location: "Switzerland",
|
|
workType: ["remote"],
|
|
timePosted: "month",
|
|
},
|
|
];
|
|
|
|
type Result = { title: string; company: string; id: string; link: string };
|
|
const results: Result[] = [];
|
|
const seen = new Set<string>();
|
|
|
|
for (const config of searches) {
|
|
console.log(`\n[${config.label}]`);
|
|
const jobs = await fetchJobs(config);
|
|
|
|
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 remote jobs found.\n`);
|
|
for (const r of results) {
|
|
console.log(`${r.title} | ${r.company} | ${r.link}`);
|
|
}
|