- Enter the number of connections iteration to the
target
variable.
This script will do the process till the value from the connections list. - Enter the value between true or false to the
loading_status
variable.
Valuetrue
will show if any connections loaded below on the Linkedin connections page. Valuefalse
won't show the loaded connection updates. - Enter the excluded usernames to the
exclude
variable.
Keep every single username in the single or double quotes e.g.['username_2']
or["username_3"]
and separate every username by,
🔴 Don't use enocoded string likeab%C4%87
as a username. In some cases, encoded string may not be matched in the excluded usernames list. - After copying the code, go to Linkedin connections page
PressCTRL + SHIFT + I
then go to console tab and paste the the copied code and then htiEnter
Follow this link to generate code
https://naiemofficial.github.io/Linkedin-bulk-connection-remover/
OR
Copy the below code (edit if needed)
var target = 50; // Enter the number of connections iteration
var loading_status = false; // See loading status in the console
var exclude = ['naiemofficial', 'username_1', 'username_2'];
var process = sl = x = i = 0;
var connects = document.querySelectorAll('#main ul > li.mn-connection-card');
var msg = {
start: "--------------------| Execution started |--------------------",
end: "---------------------| Execution ended |---------------------",
NAc: "----------------| No connections available |-----------------",
trgF: "-----------| Target value must be greater than 0 |-----------",
trgS: "----------------| Target has been completed |----------------"
};
if (sl == 0) console.log(msg.start);
if (connects.length > 0){
if (target > 0){
while (x++ < target) {
setTimeout(async () => {
connects = document.querySelectorAll('#main ul > li.mn-connection-card');
var connect = connects[i];
var uname = connect.querySelectorAll('a')[0].getAttribute('href');
uname = decodeURI(uname.split("in/")[1].replaceAll('/', ''));
var fname = connect.getElementsByClassName('mn-connection-card__name')[0].innerText;
sl++;
if (exclude.length > 0 && exclude.includes(uname) === true) {
console.log('[' + sl + '] => Action not taken for "' + fname + '"'); i++;
} else {
connect.querySelectorAll('button[type=button].mn-connection-card__dropdown-trigger')[0].click();
setTimeout(() => {
var connRmItem = connect.querySelectorAll('.artdeco-dropdown__item > button[type=button]');
if (connRmItem.length > 0) {
connRmItem[0].click();
setTimeout(async () => {
var prevNds = connects.length;
await document.querySelectorAll('#artdeco-modal-outlet button.artdeco-button--primary')[0].click();
console.log('[' + sl + '] => Connection removed with "' + fname + '"');
prevNds--;
if (connects.length > prevNds && loading_status === true){
var items = connects.length - prevNds;
var snpl = (items>1)?'s':'';
console.log('--------------------| ' + items +' item' +snpl+ ' loaded... |--------------------');
}
}, 050);
}
setTimeout(() => {
if((connects.length-1) == 0){
console.log(msg.NAc +'\n'+ msg.end);
}else if (sl >= target) {
console.log(msg.trgS +'\n'+ msg.end);
}
}, 0100);
}, 0500);
}
}, (1000 * process++));
}
}else{
console.log(msg.trgF +'\n'+ msg.end);
}
} else {
console.log(msg.NAc +'\n'+ msg.end);
}