-
-
Save thealphadollar/7c0ee76664cbd28aecc1bd235f0202fd to your computer and use it in GitHub Desktop.
// If the script does not work, you may need to allow same site scripting https://stackoverflow.com/a/50902950 | |
Linkedin = { | |
config: { | |
scrollDelay: 3000, | |
actionDelay: 5000, | |
nextPageDelay: 5000, | |
// set to -1 for no limit | |
maxRequests: -1, | |
totalRequestsSent: 0, | |
// set to false to skip adding note in invites | |
addNote: true, | |
note: "Hey {{name}}, I'm looking forward to connecting with you!", | |
}, | |
init: function (data, config) { | |
console.info("INFO: script initialized on the page..."); | |
console.debug( | |
"DEBUG: scrolling to bottom in " + config.scrollDelay + " ms" | |
); | |
setTimeout(() => this.scrollBottom(data, config), config.actionDelay); | |
}, | |
scrollBottom: function (data, config) { | |
window.scrollTo({ top: document.body.scrollHeight, behavior: "smooth" }); | |
console.debug("DEBUG: scrolling to top in " + config.scrollDelay + " ms"); | |
setTimeout(() => this.scrollTop(data, config), config.scrollDelay); | |
}, | |
scrollTop: function (data, config) { | |
window.scrollTo({ top: 0, behavior: "smooth" }); | |
console.debug( | |
"DEBUG: inspecting elements in " + config.scrollDelay + " ms" | |
); | |
setTimeout(() => this.inspect(data, config), config.scrollDelay); | |
}, | |
inspect: function (data, config) { | |
var totalRows = this.totalRows(); | |
console.debug("DEBUG: total search results found on page are " + totalRows); | |
if (totalRows >= 0) { | |
this.compile(data, config); | |
} else { | |
console.warn("WARN: end of search results!"); | |
this.complete(config); | |
} | |
}, | |
compile: function (data, config) { | |
var elements = document.querySelectorAll("button"); | |
data.pageButtons = [...elements].filter(function (element) { | |
return element.textContent.trim() === "Connect"; | |
}); | |
if (!data.pageButtons || data.pageButtons.length === 0) { | |
console.warn("ERROR: no connect buttons found on page!"); | |
console.info("INFO: moving to next page..."); | |
setTimeout(() => { | |
this.nextPage(config); | |
}, config.nextPageDelay); | |
} else { | |
data.pageButtonTotal = data.pageButtons.length; | |
console.info("INFO: " + data.pageButtonTotal + " connect buttons found"); | |
data.pageButtonIndex = 0; | |
var names = document.getElementsByClassName("entity-result__title-text"); | |
names = [...names].filter(function (element) { | |
return element.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.textContent.includes( | |
"Connect\n" | |
); | |
}); | |
data.connectNames = [...names].map(function (element) { | |
return element.innerText.split(" ")[0]; | |
}); | |
console.debug( | |
"DEBUG: starting to send invites in " + config.actionDelay + " ms" | |
); | |
setTimeout(() => { | |
this.sendInvites(data, config); | |
}, config.actionDelay); | |
} | |
}, | |
sendInvites: function (data, config) { | |
console.debug("remaining requests " + config.maxRequests); | |
if (config.maxRequests == 0) { | |
console.info("INFO: max requests reached for the script run!"); | |
this.complete(config); | |
} else { | |
console.debug( | |
"DEBUG: sending invite to " + | |
(data.pageButtonIndex + 1) + | |
" out of " + | |
data.pageButtonTotal | |
); | |
var button = data.pageButtons[data.pageButtonIndex]; | |
button.click(); | |
if (config.addNote && config.note) { | |
console.debug( | |
"DEBUG: clicking Add a note in popup, if present, in " + | |
config.actionDelay + | |
" ms" | |
); | |
setTimeout(() => this.clickAddNote(data, config), config.actionDelay); | |
} else { | |
console.debug( | |
"DEBUG: clicking done in popup, if present, in " + | |
config.actionDelay + | |
" ms" | |
); | |
setTimeout(() => this.clickDone(data, config), config.actionDelay); | |
} | |
} | |
}, | |
clickAddNote: function (data, config) { | |
var buttons = document.querySelectorAll("button"); | |
var addNoteButton = Array.prototype.filter.call(buttons, function (el) { | |
return el.textContent.trim() === "Add a note"; | |
}); | |
// adding note if required | |
if (addNoteButton && addNoteButton[0]) { | |
console.debug("DEBUG: clicking add a note button to paste note"); | |
addNoteButton[0].click(); | |
console.debug("DEBUG: pasting note in " + config.actionDelay); | |
setTimeout(() => this.pasteNote(data, config), config.actionDelay); | |
} else { | |
console.debug( | |
"DEBUG: add note button not found, clicking send on the popup in " + | |
config.actionDelay | |
); | |
setTimeout(() => this.clickDone(data, config), config.actionDelay); | |
} | |
}, | |
pasteNote: function (data, config) { | |
noteTextBox = document.getElementById("custom-message"); | |
noteTextBox.value = config.note.replace( | |
"{{name}}", | |
data.connectNames[data.pageButtonIndex] | |
); | |
noteTextBox.dispatchEvent( | |
new Event("input", { | |
bubbles: true, | |
}) | |
); | |
console.debug( | |
"DEBUG: clicking send in popup, if present, in " + | |
config.actionDelay + | |
" ms" | |
); | |
setTimeout(() => this.clickDone(data, config), config.actionDelay); | |
}, | |
clickDone: function (data, config) { | |
var buttons = document.querySelectorAll("button"); | |
var doneButton = Array.prototype.filter.call(buttons, function (el) { | |
return el.textContent.trim() === "Send"; | |
}); | |
// Click the first send button | |
if (doneButton && doneButton[0]) { | |
console.debug("DEBUG: clicking send button to close popup"); | |
doneButton[0].click(); | |
} else { | |
console.debug( | |
"DEBUG: send button not found, clicking close on the popup in " + | |
config.actionDelay | |
); | |
} | |
setTimeout(() => this.clickClose(data, config), config.actionDelay); | |
}, | |
clickClose: function (data, config) { | |
var closeButton = document.getElementsByClassName( | |
"artdeco-modal__dismiss artdeco-button artdeco-button--circle artdeco-button--muted artdeco-button--2 artdeco-button--tertiary ember-view" | |
); | |
if (closeButton && closeButton[0]) { | |
closeButton[0].click(); | |
} | |
console.info( | |
"INFO: invite sent to " + | |
(data.pageButtonIndex + 1) + | |
" out of " + | |
data.pageButtonTotal | |
); | |
config.maxRequests--; | |
config.totalRequestsSent++; | |
if (data.pageButtonIndex === data.pageButtonTotal - 1) { | |
console.debug( | |
"DEBUG: all connections for the page done, going to next page in " + | |
config.actionDelay + | |
" ms" | |
); | |
setTimeout(() => this.nextPage(config), config.actionDelay); | |
} else { | |
data.pageButtonIndex++; | |
console.debug( | |
"DEBUG: sending next invite in " + config.actionDelay + " ms" | |
); | |
setTimeout(() => this.sendInvites(data, config), config.actionDelay); | |
} | |
}, | |
nextPage: function (config) { | |
var pagerButton = document.getElementsByClassName( | |
"artdeco-pagination__button--next" | |
); | |
if ( | |
!pagerButton || | |
pagerButton.length === 0 || | |
pagerButton[0].hasAttribute("disabled") | |
) { | |
console.info("INFO: no next page button found!"); | |
return this.complete(config); | |
} | |
console.info("INFO: Going to next page..."); | |
pagerButton[0].click(); | |
setTimeout(() => this.init({}, config), config.nextPageDelay); | |
}, | |
complete: function (config) { | |
console.info( | |
"INFO: script completed after sending " + | |
config.totalRequestsSent + | |
" connection requests" | |
); | |
}, | |
totalRows: function () { | |
var search_results = document.getElementsByClassName("search-result"); | |
if (search_results && search_results.length != 0) { | |
return search_results.length; | |
} else { | |
return 0; | |
} | |
}, | |
}; | |
Linkedin.init({}, Linkedin.config); |
@ucalyptus2 Yup, works with "Connect" buttons only. That way we can send those personalized invites! I also filtered for current company employees only.
My script wasn't working when not set to send a note, so I fixed it to catch the "Send without a note" button too, here's it:
It was modified upon @hargun0360 version already:
// If the script does not work, you may need to allow same site scripting https://stackoverflow.com/a/50902950
Linkedin = {
config: {
scrollDelay: 3000,
actionDelay: 5000,
nextPageDelay: 5000,
// set to -1 for no limit
maxRequests: -1,
totalRequestsSent: 0,
// set to false to skip adding note in invites
addNote: true,
note: "Hey {{name}}, I'm looking forward to connecting with you!",
},
init: function (data, config) {
console.info("INFO: script initialized on the page...");
console.debug(
"DEBUG: scrolling to bottom in " + config.scrollDelay + " ms"
);
setTimeout(() => this.scrollBottom(data, config), config.actionDelay);
},
scrollBottom: function (data, config) {
window.scrollTo({ top: document.body.scrollHeight, behavior: "smooth" });
console.debug("DEBUG: scrolling to top in " + config.scrollDelay + " ms");
setTimeout(() => this.scrollTop(data, config), config.scrollDelay);
},
scrollTop: function (data, config) {
window.scrollTo({ top: 0, behavior: "smooth" });
console.debug(
"DEBUG: inspecting elements in " + config.scrollDelay + " ms"
);
setTimeout(() => this.inspect(data, config), config.scrollDelay);
},
inspect: function (data, config) {
var totalRows = this.totalRows();
console.debug("DEBUG: total search results found on page are " + totalRows);
if (totalRows >= 0) {
this.compile(data, config);
} else {
console.warn("WARN: end of search results!");
this.complete(config);
}
},
compile: function (data, config) {
var elements = document.querySelectorAll(".entity-result__actions button");
var isCurrent = [];
var paragraphs = document.getElementsByClassName(
"entity-result__summary--2-lines"
);
Array.from(paragraphs).forEach((element) => {
if (element.textContent.includes("Current:")) {
isCurrent.push(true);
} else {
isCurrent.push(false);
}
});
data.pageButtons = [...elements].filter((element, index) => {
if (element.textContent.trim() === "Connect" && isCurrent[index]) {
return element.textContent.trim() === "Connect";
}
});
if (!data.pageButtons || data.pageButtons.length === 0) {
console.warn("ERROR: no connect buttons found on page!");
console.info("INFO: moving to next page...");
setTimeout(() => {
this.nextPage(config);
}, config.nextPageDelay);
} else {
data.pageButtonTotal = data.pageButtons.length;
console.info("INFO: " + data.pageButtonTotal + " connect buttons found");
data.pageButtonIndex = 0;
var names = document.getElementsByClassName("entity-result__title-text");
names = [...names].filter(function (element, index) {
if (isCurrent[index]) {
return element.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.textContent.includes(
"Connect\n"
);
}
});
data.connectNames = [...names].map(function (element) {
return element.innerText.split(" ")[0];
});
console.debug(
"DEBUG: starting to send invites in " + config.actionDelay + " ms"
);
setTimeout(() => {
this.sendInvites(data, config);
}, config.actionDelay);
}
},
sendInvites: function (data, config) {
console.debug("remaining requests " + config.maxRequests);
if (config.maxRequests == 0) {
console.info("INFO: max requests reached for the script run!");
this.complete(config);
} else {
console.debug(
"DEBUG: sending invite to " +
(data.pageButtonIndex + 1) +
" out of " +
data.pageButtonTotal
);
var button = data.pageButtons[data.pageButtonIndex];
button.click();
if (config.addNote && config.note) {
console.debug(
"DEBUG: clicking Add a note in popup, if present, in " +
config.actionDelay +
" ms"
);
setTimeout(() => this.clickAddNote(data, config), config.actionDelay);
} else {
console.debug(
"DEBUG: clicking done in popup, if present, in " +
config.actionDelay +
" ms"
);
setTimeout(() => this.clickDone(data, config), config.actionDelay);
}
}
},
clickAddNote: function (data, config) {
var buttons = document.querySelectorAll("button");
var addNoteButton = Array.prototype.filter.call(buttons, function (el) {
return el.textContent.trim() === "Add a note";
});
// adding note if required
if (addNoteButton && addNoteButton[0]) {
console.debug("DEBUG: clicking add a note button to paste note");
addNoteButton[0].click();
console.debug("DEBUG: pasting note in " + config.actionDelay);
setTimeout(() => this.pasteNote(data, config), config.actionDelay);
} else {
console.debug(
"DEBUG: add note button not found, clicking send on the popup in " +
config.actionDelay
);
setTimeout(() => this.clickDone(data, config), config.actionDelay);
}
},
pasteNote: function (data, config) {
noteTextBox = document.getElementById("custom-message");
noteTextBox.value = config.note.replace(
"{{name}}",
data.connectNames[data.pageButtonIndex]
);
noteTextBox.dispatchEvent(
new Event("input", {
bubbles: true,
})
);
console.debug(
"DEBUG: clicking send in popup, if present, in " +
config.actionDelay +
" ms"
);
setTimeout(() => this.clickDone(data, config), config.actionDelay);
},
clickDone: function (data, config) {
var buttons = document.querySelectorAll("button");
var doneButton = Array.prototype.filter.call(buttons, function (el) {
return el.textContent.trim() === "Send" || el.textContent.trim() === "Send without a note";
});
// Click the first send button
if (doneButton && doneButton[0]) {
console.debug("DEBUG: clicking send button to close popup");
doneButton[0].click();
} else {
console.debug(
"DEBUG: send button not found, clicking close on the popup in " +
config.actionDelay
);
}
setTimeout(() => this.clickClose(data, config), config.actionDelay);
},
clickClose: function (data, config) {
var closeButton = document.getElementsByClassName(
"artdeco-modal__dismiss artdeco-button artdeco-button--circle artdeco-button--muted artdeco-button--2 artdeco-button--tertiary ember-view"
);
if (closeButton && closeButton[0]) {
closeButton[0].click();
}
console.info(
"INFO: invite sent to " +
(data.pageButtonIndex + 1) +
" out of " +
data.pageButtonTotal
);
config.maxRequests--;
config.totalRequestsSent++;
if (data.pageButtonIndex === data.pageButtonTotal - 1) {
console.debug(
"DEBUG: all connections for the page done, going to next page in " +
config.actionDelay +
" ms"
);
setTimeout(() => this.nextPage(config), config.actionDelay);
} else {
data.pageButtonIndex++;
console.debug(
"DEBUG: sending next invite in " + config.actionDelay + " ms"
);
setTimeout(() => this.sendInvites(data, config), config.actionDelay);
}
},
nextPage: function (config) {
var pagerButton = document.getElementsByClassName(
"artdeco-pagination__button--next"
);
if (
!pagerButton ||
pagerButton.length === 0 ||
pagerButton[0].hasAttribute("disabled")
) {
console.info("INFO: no next page button found!");
return this.complete(config);
}
console.info("INFO: Going to next page...");
pagerButton[0].click();
setTimeout(() => this.init({}, config), config.nextPageDelay);
},
complete: function (config) {
console.info(
"INFO: script completed after sending " +
config.totalRequestsSent +
" connection requests"
);
},
totalRows: function () {
var search_results = document.getElementsByClassName("search-result");
if (search_results && search_results.length != 0) {
return search_results.length;
} else {
return 0;
}
},
};
Linkedin.init({}, Linkedin.config);
Updated Code for Sending Invites without Adding Notes
`Linkedin = {
config: {
scrollDelay: 3000,
actionDelay: 5000,
nextPageDelay: 5000,
// set to -1 for no limit
maxRequests: -1,
totalRequestsSent: 0,
// set to false to skip adding note in invites
addNote: false,
note: "Hey {{name}}, I'm looking forward to connecting with you!",
},
init: function (data, config) {
console.info("INFO: script initialized on the page...");
console.debug(
"DEBUG: scrolling to bottom in " + config.scrollDelay + " ms"
);
setTimeout(() => this.scrollBottom(data, config), config.actionDelay);
},
scrollBottom: function (data, config) {
window.scrollTo({ top: document.body.scrollHeight, behavior: "smooth" });
console.debug("DEBUG: scrolling to top in " + config.scrollDelay + " ms");
setTimeout(() => this.scrollTop(data, config), config.scrollDelay);
},
scrollTop: function (data, config) {
window.scrollTo({ top: 0, behavior: "smooth" });
console.debug(
"DEBUG: inspecting elements in " + config.scrollDelay + " ms"
);
setTimeout(() => this.inspect(data, config), config.scrollDelay);
},
inspect: function (data, config) {
var totalRows = this.totalRows();
console.debug("DEBUG: total search results found on page are " + totalRows);
if (totalRows >= 0) {
this.compile(data, config);
} else {
console.warn("WARN: end of search results!");
this.complete(config);
}
},
compile: function (data, config) {
var elements = document.querySelectorAll("button");
data.pageButtons = [...elements].filter(function (element) {
return element.textContent.trim() === "Connect";
});
if (!data.pageButtons || data.pageButtons.length === 0) {
console.warn("ERROR: no connect buttons found on page!");
console.info("INFO: moving to next page...");
setTimeout(() => {
this.nextPage(config);
}, config.nextPageDelay);
} else {
data.pageButtonTotal = data.pageButtons.length;
console.info("INFO: " + data.pageButtonTotal + " connect buttons found");
data.pageButtonIndex = 0;
var names = document.getElementsByClassName("entity-result__title-text");
names = [...names].filter(function (element) {
return element.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.textContent.includes(
"Connect\n"
);
});
data.connectNames = [...names].map(function (element) {
return element.innerText.split(" ")[0];
});
console.debug(
"DEBUG: starting to send invites in " + config.actionDelay + " ms"
);
setTimeout(() => {
this.sendInvites(data, config);
}, config.actionDelay);
}
},
sendInvites: function (data, config) {
console.debug("remaining requests " + config.maxRequests);
if (config.maxRequests == 0) {
console.info("INFO: max requests reached for the script run!");
this.complete(config);
} else {
console.debug(
"DEBUG: sending invite to " +
(data.pageButtonIndex + 1) +
" out of " +
data.pageButtonTotal
);
var button = data.pageButtons[data.pageButtonIndex];
button.click();
setTimeout(() => this.clickAddNote(data, config), config.actionDelay);
}
},
clickAddNote: function (data, config) {
var buttons = document.querySelectorAll("button");
var addNoteButton = Array.prototype.filter.call(buttons, function (el) {
return el.textContent.trim() === "Send without a note";
});
// adding note if required
addNoteButton[0].click();
setTimeout(() => this.clickClose(data, config), config.actionDelay);
},
clickClose: function (data, config) {
config.maxRequests--;
config.totalRequestsSent++;
if (data.pageButtonIndex === data.pageButtonTotal - 1) {
console.debug(
"DEBUG: all connections for the page done, going to next page in " +
config.actionDelay +
" ms"
);
setTimeout(() => this.nextPage(config), config.actionDelay);
} else {
data.pageButtonIndex++;
console.debug(
"DEBUG: sending next invite in " + config.actionDelay + " ms"
);
setTimeout(() => this.sendInvites(data, config), config.actionDelay);
}
},
nextPage: function (config) {
var pagerButton = document.getElementsByClassName(
"artdeco-pagination__button--next"
);
if (
!pagerButton ||
pagerButton.length === 0 ||
pagerButton[0].hasAttribute("disabled")
) {
console.info("INFO: no next page button found!");
return this.complete(config);
}
console.info("INFO: Going to next page...");
pagerButton[0].click();
setTimeout(() => this.init({}, config), config.nextPageDelay);
},
complete: function (config) {
console.info(
"INFO: script completed after sending " +
config.totalRequestsSent +
" connection requests"
);
},
totalRows: function () {
var search_results = document.getElementsByClassName("search-result");
if (search_results && search_results.length != 0) {
return search_results.length;
} else {
return 0;
}
},
};
Linkedin.init({}, Linkedin.config);`
For some reason, when not adding in the notes, the connection request never goes through
Hey if your not bothered about sending requests with notes then you can just use this altered version of the script I made. Also updated the class names / ids for the current version of the site so that it functions correctly. You might want to increase the delays if your internet speed / hardware is on the lower end (for me it works fine).
Linkedin = {
config: {
scrollDelay: 1000,
actionDelay: 250,
nextPageDelay: 250,
maxRequests: -1,
totalRequestsSent: 0,
},
init: function (data, config) {
console.info("INFO: script initialized on the page...");
console.debug(
"DEBUG: scrolling to bottom in " + config.scrollDelay + " ms"
);
setTimeout(() => this.scrollBottom(data, config), config.actionDelay);
},
scrollBottom: function (data, config) {
window.scrollTo({ top: document.body.scrollHeight, behavior: "smooth" });
console.debug("DEBUG: scrolling to top in " + config.scrollDelay + " ms");
setTimeout(() => this.scrollTop(data, config), config.scrollDelay);
},
scrollTop: function (data, config) {
window.scrollTo({ top: 0, behavior: "smooth" });
console.debug(
"DEBUG: inspecting elements in " + config.scrollDelay + " ms"
);
setTimeout(() => this.inspect(data, config), config.scrollDelay);
},
inspect: function (data, config) {
var totalRows = this.totalRows();
console.debug("DEBUG: total search results found on page are " + totalRows);
if (totalRows >= 0) {
this.compile(data, config);
} else {
console.warn("WARN: end of search results!");
this.complete(config);
}
},
compile: function (data, config) {
var elements = document.querySelectorAll("button");
data.pageButtons = [...elements].filter(function (element) {
return element.textContent.trim() === "Connect";
});
if (!data.pageButtons || data.pageButtons.length === 0) {
console.warn("ERROR: no connect buttons found on page!");
console.info("INFO: moving to next page...");
setTimeout(() => {
this.nextPage(config);
}, config.nextPageDelay);
} else {
data.pageButtonTotal = data.pageButtons.length;
console.info("INFO: " + data.pageButtonTotal + " connect buttons found");
data.pageButtonIndex = 0;
console.debug(
"DEBUG: starting to send invites in " + config.actionDelay + " ms"
);
setTimeout(() => {
this.sendInvites(data, config);
}, config.actionDelay);
}
},
sendInvites: function (data, config) {
console.debug("remaining requests " + config.maxRequests);
if (config.maxRequests == 0) {
console.info("INFO: max requests reached for the script run!");
this.complete(config);
} else {
console.debug(
"DEBUG: sending invite to " +
(data.pageButtonIndex + 1) +
" out of " +
data.pageButtonTotal
);
var button = data.pageButtons[data.pageButtonIndex];
button.click();
console.debug(
"DEBUG: clicking send in popup, if present, in " +
config.actionDelay +
" ms"
);
setTimeout(() => this.clickSend(data, config), config.actionDelay);
}
},
clickSend: function (data, config) {
var buttons = document.querySelectorAll("button");
var sendButton = Array.prototype.filter.call(buttons, function (el) {
return el.textContent.trim() === "Send without a note";
});
// Click the first send button
if (sendButton && sendButton[0]) {
console.debug("DEBUG: clicking send button to close popup");
sendButton[0].click();
} else {
console.debug(
"DEBUG: send button not found, clicking close on the popup in " +
config.actionDelay
);
}
setTimeout(() => this.clickClose(data, config), config.actionDelay);
},
clickClose: function (data, config) {
var closeButton = document.getElementById("ember1683");
if (closeButton) {
closeButton.click();
}
console.info(
"INFO: invite sent to " +
(data.pageButtonIndex + 1) +
" out of " +
data.pageButtonTotal
);
config.maxRequests--;
config.totalRequestsSent++;
if (data.pageButtonIndex === data.pageButtonTotal - 1) {
console.debug(
"DEBUG: all connections for the page done, going to next page in " +
config.actionDelay +
" ms"
);
setTimeout(() => this.nextPage(config), config.actionDelay);
} else {
data.pageButtonIndex++;
console.debug(
"DEBUG: sending next invite in " + config.actionDelay + " ms"
);
setTimeout(() => this.sendInvites(data, config), config.actionDelay);
}
},
nextPage: function (config) {
var pagerButton = document.getElementsByClassName(
"artdeco-pagination__button--next"
);
if (
!pagerButton ||
pagerButton.length === 0 ||
pagerButton[0].hasAttribute("disabled")
) {
console.info("INFO: no next page button found!");
return this.complete(config);
}
console.info("INFO: Going to next page...");
pagerButton[0].click();
setTimeout(() => this.init({}, config), config.nextPageDelay);
},
complete: function (config) {
console.info(
"INFO: script completed after sending " +
config.totalRequestsSent +
" connection requests"
);
},
totalRows: function () {
var search_results = document.getElementsByClassName("search-result");
if (search_results && search_results.length != 0) {
return search_results.length;
} else {
return 0;
}
},
};
Linkedin.init({}, Linkedin.config);
I think we can break the script into two independent logical flows -> main script that handles sending connection requests (current) + conditional script that runs in a new tab for users with "Message" or "Follow".
For the second script, I propose writing it with minimal context passing from the last page. As is shared in the StackOverflow answer, this new conditional script will be executed in the newly opened tab and send a message (context passed from config of the main script) or Follow.
If it's not feasible for you, I'll try to write the conditional script over the weekend 🙇🏻
@valerioviale @forkbabu
Any update on the script for handling the "Message" or "Follow" for connection? @thealphadollar
"Message" and "Follow" only shows up if you have already sent a request to that person or if you are already connected with them (im pretty sure).
So right now the script should work fine as it just ignores these buttons.
BTW here is the link for my repo w/ the script. Can't remember if I updated any more since I made the previous comment.
https://github.com/leomosley/linkedin-connections-script/
I think it's not true.
I can still able to connect manually by going inside their profile. Where we have a "more" button.
And the link you share getting a 404 error. @leomosley
Oops the repo was private. Should be fixed now.
Yes you are right, don't have a fix right now for the follow or message.
The thing is they could be someone you have already connected or not but you can't tell unless you to their profile and click on the more tab like you said.
You can only send around 100-200 invitation requests a week so its probably quicker to just let it skip the follow/message and you'll reach the limit pretty quickly anyway. 🤷♂️
@hargun0360 were you able to only filter out people with "Connect" buttons? People with "Message" buttons or some other kind of button won't be able to take personalized invites..