Files
linkme/scripts/all-swiss-temp.ts
T
rodado b4957025b1 chore: update search scripts, extra sources and post drafts
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.
2026-08-27 09:03:05 +02:00

47 lines
2.6 KiB
TypeScript

import { KEYWORDS } from "../config.ts";
import type { SearchConfig } from "../config.ts";
import { fetchJobs, isEnglishContent } from "../fetch.ts";
import { readFileSync } from "fs";
const csv = readFileSync("./results/jobs.csv", "utf8");
const existingIds = new Set(
[...csv.matchAll(/jobs\/view\/(\d+)\//g)].map((m) => m[1])
);
const searches: SearchConfig[] = [
{ label: "Switzerland (all)", keywords: KEYWORDS, location: "Switzerland", workType: ["onsite", "hybrid", "remote"], timePosted: "month" },
{ label: "Zürich Area", keywords: KEYWORDS, geoId: "90009888", location: "Zürich Area", workType: ["onsite", "hybrid"], timePosted: "month" },
{ label: "Basel Metro", keywords: KEYWORDS, geoId: "90009885", location: "Basel Metropolitan Area", workType: ["onsite", "hybrid"], timePosted: "month" },
{ label: "Bern", keywords: KEYWORDS, location: "Bern, Switzerland", workType: ["onsite", "hybrid"], timePosted: "month" },
{ label: "Geneva", keywords: KEYWORDS, location: "Geneva, Switzerland", workType: ["onsite", "hybrid"], timePosted: "month" },
{ label: "Lausanne", keywords: KEYWORDS, location: "Lausanne, Switzerland", workType: ["onsite", "hybrid"], timePosted: "month" },
{ label: "Zug", keywords: KEYWORDS, location: "Zug, Switzerland", workType: ["onsite", "hybrid"], timePosted: "month" },
{ label: "Lucerne", keywords: KEYWORDS, location: "Lucerne, Switzerland", workType: ["onsite", "hybrid"], timePosted: "month" },
{ label: "St. Gallen", keywords: KEYWORDS, location: "St. Gallen, Switzerland", workType: ["onsite", "hybrid"], timePosted: "month" },
{ label: "Lugano", keywords: KEYWORDS, location: "Lugano, Switzerland", workType: ["onsite", "hybrid"], timePosted: "month" },
];
const seen = new Map<string, any>();
for (const s of searches) {
const jobs = await fetchJobs(s);
for (const j of jobs) if (!seen.has(j.id) && !existingIds.has(j.id)) seen.set(j.id, j);
console.log(`${s.label}: ${jobs.length} raw, ${seen.size} unique new so far`);
}
const MS_RE = /\b(\.net|c#|azure|sharepoint|dynamics|power\s?(bi|platform|apps)|sccm|intune|windows)\b/i;
const candidates = [...seen.values()].filter((j) => !MS_RE.test(j.title));
console.log(`\n${candidates.length} candidates. Checking English content…\n`);
const results = [];
for (const j of candidates) {
const ok = await isEnglishContent(j.id);
if (ok) results.push(j);
else console.log(` dropped (non-English): ${j.title}`);
}
console.log(`\n=== ${results.length} NEW SWISS JOBS ===\n`);
for (const j of results) {
console.log(`${j.title} | ${j.company} | ${j.location} | ${j.postedAt}`);
console.log(` ${j.link}`);
}