Auto-deploy: 2026-06-05 23:06:29

This commit is contained in:
Hamza-Ayed
2026-06-05 23:06:29 +03:00
parent 728e45c065
commit 57784c790a

View File

@@ -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;
}