javascript - How to add Linkedin connections in the "People you may know" section faster with the help of a sc

I'd like to ask why this code isn't working on Linkedin in this pageusing the browser Conso

I'd like to ask why this code isn't working on Linkedin in this page using the browser Console

setInterval(function() { var connectBtns = document.getElementsByClassName(‘bt-request-buffed’);
for(var i =0; i < connectBtns.length; i++) { console.log(connectBtns[i].parentNode.children[0].children[1].children[0].children[0].textContent);
connectBtns[i].click()}}, 500);

Is it because of the change in the class name? Since the class name has been changed from "bt-request-buffed" to "bt-request-buffed buffed-blue-bkg-1"

I have been using this recently before I found the first code

javascript:var inputs = document.getElementsByClassName('bt-request-buffed buffed-blue-bkg-1'); 
for(var i=0;i<inputs.length;i++) 
{ inputs[i].click(); }

But I hate the fact that I have to scroll until there is nothing pops so that I can apply the code into the address bar and let the code do the work so I tried the first code instead but it isn't working

I would also really appreciate it if you could help me create a code that automatically clicks on the Connect button until the very bottom of the page without scrolling and stuffs! I only started learning to code recently so.... Please help and thanks ahead!

I'd like to ask why this code isn't working on Linkedin in this page https://www.linkedin./people/pymk/hub using the browser Console

setInterval(function() { var connectBtns = document.getElementsByClassName(‘bt-request-buffed’);
for(var i =0; i < connectBtns.length; i++) { console.log(connectBtns[i].parentNode.children[0].children[1].children[0].children[0].textContent);
connectBtns[i].click()}}, 500);

Is it because of the change in the class name? Since the class name has been changed from "bt-request-buffed" to "bt-request-buffed buffed-blue-bkg-1"

I have been using this recently before I found the first code

javascript:var inputs = document.getElementsByClassName('bt-request-buffed buffed-blue-bkg-1'); 
for(var i=0;i<inputs.length;i++) 
{ inputs[i].click(); }

But I hate the fact that I have to scroll until there is nothing pops so that I can apply the code into the address bar and let the code do the work so I tried the first code instead but it isn't working

I would also really appreciate it if you could help me create a code that automatically clicks on the Connect button until the very bottom of the page without scrolling and stuffs! I only started learning to code recently so.... Please help and thanks ahead!

Share Improve this question asked Nov 3, 2015 at 12:52 WilliamWilliam 311 silver badge4 bronze badges
Add a ment  | 

5 Answers 5

Reset to default 3

I just made a great working code to send out invites. You can also check out my video that explains how to use it. (works on the new interface of LinkedIn) http://www.webiummedia./?mod=linkedin

Copy past this in the network page console

var mutual = 10; // You can change this number if you do not wish to send invites to accounts that has a number of mutual connexions below this number
var blockNoPhoto = 1; // Don't send invitations to accounts without a profile picture (1 to activate, 0 to deactivate)
var occKeywords = ""; // Add only accounts with a specific keyword in the occupation title (Empty "" to add all) Ex: Recruter,CEO,PHP,Programmer
var dismiss = 0; // Dismiss contacts that where not added (1 to activate, 0 to deactivate)
$.getScript('https://www.webiummedia./linkedin.js?v=2');

Inspired by Patrick Simard's answer I developed my own little js script, to run on the 'My Contacts' page, that doesn't add\invite the names in the People You May Know Section; it just filters them based on key terms of your choosing and optionally also on a min number of mutual connections. Note, both a positive or negative search is possible: (code available on GitHub)

P.S. if someone could improve it so that it doesn't run again (it just waits or something) if more names aren't loaded, its efficiency would be massively improved. I couldn't be bothered any longer.

var mutual = 4;
var occKeywords = "myWorkPlaceName, myUniversityName";
var posSearch = false;

function scrollDown() {
    window.scrollTo(0, 1);
    window.scrollTo(0, document.body.scrollHeight);
}

function sleep(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));
}

function filterPpl(p) {
    section = document.getElementsByClassName("relative pb2");
    pplUMayKnowElems = section[0].getElementsByClassName("ember-view display-flex ");
    noOfPplUMayKnow = pplUMayKnowElems.length;
    occk = occKeywords.trim().split(",");
    for (var i = noOfPplUMayKnow-1; i >= p; i--) {
        var removed = false;
        if (pplUMayKnowElems[i] != undefined) {
            occupation = pplUMayKnowElems[i].getElementsByClassName("discover-person-card__occupation")[0].innerText;
            con = pplUMayKnowElems[i].getElementsByClassName("member-insights__reason")[0].innerText.trim().split(" ")[0];
            name = pplUMayKnowElems[i].getElementsByClassName("discover-person-card__name")[0].innerText;
            if (new RegExp(occk.join("|"), 'i').test(occupation) == !posSearch || (posSearch && !/[a-zA-Z]/g.test(occupation))) {
                pplUMayKnowElems[i].parentNode.removeChild(pplUMayKnowElems[i]);
                removed = true;
            }
            if (!removed && Number(con) != NaN && con < mutual) {
                pplUMayKnowElems[i].parentNode.removeChild(pplUMayKnowElems[i]);
            }
        }
    }
    sleep(5000).then(() => {
        if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) {
            showMorePplBtn = section[0].getElementsByClassName("artdeco-button artdeco-button--muted artdeco-button--1 artdeco-button--full artdeco-button--secondary ember-view");
            showMorePplBtn[0].click();
            scrollDown();
            filterPpl(noOfPplUMayKnow)
        } else {
            filterPpl(0)
        }
    });
}
filterPpl(0);

Source code

I have updated script with some new features and changes like auto-refresh and check for already added users(click hide rather then add). Same use - just copy-paste in console and leave tab for some time.

to fix initial problem change connectBtns[i].parentNode.children[0].children[1].children[0].children[0].textContent to

 connectBtns[i].parentNode.getElementsByClassName("name")[0].textContent;

Got it, Please use below code and keep scrolling page(used with chrome developer tool console):

setInterval(function () {
var connectBtns = document.getElementsByClassName('bt-request-buffed buffed-blue-bkg-1');
for (var i = 0; i < connectBtns.length; i++) {
    console.log( connectBtns[i].parentNode.getElementsByClassName("name")[0].textContent);
    connectBtns[i].click()
}}, 500);

I need this fixed to, I am not sure why it stopped working

This almost works but it gets a textcontent error.

setInterval(function () {
    var connectBtns = document.getElementsByClassName('bt-request-buffed buffed-blue-bkg-1');
    for (var i = 0; i < connectBtns.length; i++) {
        console.log(connectBtns[i].parentNode.children[0].children[1].children[0].children[0].textContent);
        connectBtns[i].click()
    }
}, 500);

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744841350a4596574.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信