javascript unfollow instagram

Solutions on MaxInterview for javascript unfollow instagram by the best coders in the world

showing results for - "javascript unfollow instagram"
Lotta
10 Mar 2017
1// Open "Follwing Pop Up"
2
3var ufwTotalCounter = 0;
4var ufwCounter = 0;
5var maxUfwsPerBatch = 13;
6var fwDialogSelector = "._4gt3b";
7var fwButtonSelector = "._cx1ua button:contains('Following')";
8var delayBetweenUfwClicks = 4000;
9var delayRandomness = 4000;
10var delayBetweenUfwBatches = 600000;
11
12var script = document.createElement("script");
13script.src = "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js";
14document.getElementsByTagName('body')[0].appendChild(script);
15
16function unfollow() {
17    var delay = 5000;
18    if (ufwCounter < maxUfwsPerBatch) {
19        if (jQuery(fwButtonSelector).length) {
20            jQuery(jQuery(fwButtonSelector)[0]).click();
21            ufwCounter++;
22            ufwTotalCounter++;
23            console.log("Unfollowed " + ufwTotalCounter + " person(s)");
24        } else {
25            jQuery(fwDialogSelector).scrollTop(100000000);
26            console.log("No more 'Follow' buttons. Scrolling down.");
27        }
28        delay = Math.random() * delayRandomness + delayBetweenUfwClicks;
29    } else {
30        ufwCounter = 0;
31        delay = delayBetweenUfwBatches;
32        console.log("Pausing with execution for " + delay/1000 + " seconds...");
33    }
34    setTimeout(function() {
35        unfollow();
36    }, delay);
37}
38
39function waitForjQuery(callback)
40{
41    if ( !window.jQuery ) {
42        setTimeout(function() {
43            waitForjQuery(callback);
44        }, 50);
45    } else {
46        callback();
47    }
48}
49
50waitForjQuery(function() {
51    if (!jQuery(fwDialogSelector).length) {
52        alert("Open the 'Following' dialog!");
53    }
54    unfollow();
55});