From c01abe8884d5bf042630a59a3da5ad1089864e9b Mon Sep 17 00:00:00 2001 From: Claw Date: Fri, 6 Mar 2026 02:44:17 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20location=20scraper=20=E2=80=94=20use=20.?= =?UTF-8?q?tvm=5F=5Ftext=20selector,=20also=20capture=20work=5Ftype=20(Rem?= =?UTF-8?q?ote/Hybrid/On-site)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/linkedin.mjs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/linkedin.mjs b/lib/linkedin.mjs index 3cfb9df..ee6ee17 100644 --- a/lib/linkedin.mjs +++ b/lib/linkedin.mjs @@ -77,13 +77,16 @@ export async function searchLinkedIn(page, search, { onPage, onKeyword } = {}) { const title = document.querySelector('.job-details-jobs-unified-top-card__job-title, h1[class*="title"]')?.textContent?.trim() || document.querySelector('.jobs-unified-top-card__job-title')?.textContent?.trim() || ''; const company = document.querySelector('.job-details-jobs-unified-top-card__company-name a, .jobs-unified-top-card__company-name a')?.textContent?.trim() || ''; - const location = document.querySelector('.job-details-jobs-unified-top-card__bullet, .jobs-unified-top-card__bullet')?.textContent?.trim() || ''; + // .tvm__text spans contain: location, "·", time ago, "·", applicants, work type, etc. + const tvmTexts = Array.from(document.querySelectorAll('.tvm__text')).map(e => e.textContent.trim()).filter(s => s && s !== '·'); + const location = tvmTexts[0] || ''; // first non-separator is location + const workType = tvmTexts.find(t => ['Remote', 'Hybrid', 'On-site'].includes(t)) || ''; const tl = title.toLowerCase(), cl = company.toLowerCase(); for (const ex of excludes) { if (tl.includes(ex.toLowerCase()) || cl.includes(ex.toLowerCase())) return null; } - return { title, company, location }; + return { title, company, location, work_type: workType }; }, { id: jobId, track: search.track, excludes: search.exclude_keywords || [] }); if (!meta) { seenIds.add(jobId); continue; } // excluded