#!/usr/bin/env bun import { buildUrl, isEnglishContent, NON_ENGLISH_RE, JUNIOR_TITLE_RE, JAVA_TITLE_RE, SOFTWARE_TITLE_RE } from "../fetch.ts"; import type { SearchConfig } from "../config.ts"; const HEADERS = { "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36", "Accept-Language": "en-US,en;q=0.9", Accept: "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8", }; function clean(raw: string): string { return raw.replace(/<[^>]+>/g, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/\s+/g, " ").trim(); } // Same as fetch.ts parseJobs but WITHOUT the Switzerland location guard function parseJobs(html: string, label: string) { const jobs: { id: string; title: string; company: string; link: string; location: string }[] = []; const idRe = /data-entity-urn="urn:li:jobPosting:(\d+)"/g; const positions: { id: string; start: number }[] = []; let m; while ((m = idRe.exec(html)) !== null) positions.push({ id: m[1], start: m.index }); for (let i = 0; i < positions.length; i++) { const { id, start } = positions[i]; const card = html.slice(start, Math.min(positions[i + 1]?.start ?? Infinity, start + 3000)); const titleM = card.match(/