Last active
January 22, 2023 01:43
-
-
Save hustlestar/2a52eb255d73149abb14932615415746 to your computer and use it in GitHub Desktop.
Script to add new connections on linkedin automatically.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//copy next 1 line to the browser console on the linkedin network page https://www.linkedin.com/mynetwork/ | |
setInterval(function() { window.scrollTo(0, document.body.scrollHeight); }, 2000); | |
//wait several minutes then copy all following lines to console | |
var currentSuccesfulConnections=0; | |
var totalConnections=0; | |
var totalInvitations=0; | |
var interestingConnections=0; | |
var inviteText=""; | |
var connections=jQuery('.button-secondary-small'); | |
var job_titles=jQuery('.pymk-card__occupation'); | |
var interesting_connections = []; | |
var looking_for = ['hr','big data','bigdata','recruiter','recruit','data engineer', 'spark', 'hadoop', 'talent acquisition', 'talent', 'resource']; | |
var exclude_words = ['epam']; | |
function addConnection(connection){ | |
var btn_type=connection.text().trim().split(' ')[0].trim(); | |
console.log(new Date() + "Adding connection "); | |
if (btn_type!=inviteText) { | |
connection.trigger('click'); | |
currentSuccesfulConnections+=1; | |
}else{ | |
totalInvitations+=1; | |
} | |
} | |
function searchTitle(title, array) { | |
for (i = 0; i < array.length; i++){ | |
if ( title.search(array[i]) > -1 ){ | |
return true; | |
} | |
} | |
return false; | |
} | |
function createConnections(text_invite,max_succesful_connections){ | |
inviteText=text_invite; | |
totalConnections=connections.size(); | |
$(job_titles).each(function( index ) { | |
var title = $( this ).text().toLowerCase(); | |
if (!searchTitle(title, exclude_words) && searchTitle(title, looking_for)) { | |
interesting_connections.push(index); | |
} | |
}); | |
if(max_succesful_connections==0){ | |
max_succesful_connections=totalConnections; | |
} | |
$(connections).each(function(index, value) { | |
if(interesting_connections.includes(index)){ | |
interestingConnections +=1; | |
if(currentSuccesfulConnections<max_succesful_connections){ | |
setTimeout(addConnection, index * 1000, $(this)); | |
}else{ | |
return false; | |
} | |
} | |
}); | |
console.log("Possible total connections: " + totalConnections); | |
console.log("Interesting invitations: " + interestingConnections); | |
console.log("Successful total connections: " + currentSuccesfulConnections); | |
console.log("Total invitations avoided: " + totalInvitations); | |
} | |
// Don't touch anything above this line | |
// Change "Invite" to the word Invite in your language if you use LinkedIn in a different language (for example if you use LinkedIn in Spanish, you should change "Invite" with "Invitar") | |
// If you want to restrict the number of connections change the 0 with another number. 0 means unlimited connections, it will try to connect with everyone in your recommended connections. If you change it to another number, you will do the script connect with a maximum that number of users. Fo example, if I change 0 to 100, I will connect with just 100 persons (as much) | |
createConnections("Invite", 40); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment