From 57784c790a0149d002e43dc55e052cad6113a8e3 Mon Sep 17 00:00:00 2001 From: Hamza-Ayed Date: Fri, 5 Jun 2026 23:06:29 +0300 Subject: [PATCH] Auto-deploy: 2026-06-05 23:06:29 --- search_analyzer.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/search_analyzer.js b/search_analyzer.js index 0449566..ca70ac0 100644 --- a/search_analyzer.js +++ b/search_analyzer.js @@ -96,18 +96,24 @@ // The most bulletproof way to find a profile card is to find the main Action Button (Connect/Message/Follow) // and then go up the DOM tree until we find the container that holds the whole profile - let buttons = Array.from(document.querySelectorAll('button')).filter(btn => { - let txt = btn.innerText.toLowerCase().trim(); - return txt === 'connect' || txt === 'message' || txt === 'pending' || txt === 'follow'; + let actionElements = Array.from(document.querySelectorAll('button, a.artdeco-button')).filter(el => { + let txt = el.innerText.toLowerCase().trim(); + // Must contain the word, but not be a huge paragraph + return txt.length < 30 && (txt.includes('connect') || txt.includes('message') || txt.includes('pending') || txt.includes('follow')); }); - buttons.forEach(btn => { + actionElements.forEach(btn => { let container = btn.parentElement; - // Go up the DOM tree (max 10 levels) to find the list item - for(let i=0; i<10; i++) { + // Go up the DOM tree (max 15 levels) to find the list item + for(let i=0; i<15; i++) { if (!container) break; - // A valid card container is usually an LI and contains an image - if (container.tagName === 'LI' && container.querySelector('img')) { + // A valid card container is usually an LI and contains an image and a profile link + if (container.tagName === 'LI' && container.querySelector('img') && container.querySelector('a[href*="/in/"]')) { + uniqueCards.add(container); + break; + } + // Fallback if it's not an LI but a direct container div used by some LinkedIn versions + if (container.classList && (container.classList.contains('reusable-search__result-container') || container.classList.contains('search-entity'))) { uniqueCards.add(container); break; }