Automatically Unfollow non Followers on Steemit script

First we want to form an array that contains all our followers:

1.Open new text document and paste the following code


<html>
<script src="http://cdn.steemjs.com/lib/latest/steem.min.js"></script>
<script>
function mojaFunkcija(){
    steem.api.getFollowers
        ('emirk',
        'a-0-0',
        null,
        1000,
        function(err, result) 
            {
                if(err) console.log(err);
                else
                {
                    for(i=0;i<result.length;i++) 
                    {
                        var x="\""+result[i].follower+"\",";
                        document.write(x);
                    }
                }
            }
        );
}
mojaFunkcija();
</script>
<body>
</body>
</html>

-replace: 'emirk' with your username,'a-0-0' with a name of you first follower on your followers page,and 1000 with a number of your followers(or a number greater than that)

2.Save file as .html and open it

3.-Copy all data from a page without the last ','

-open new text document and write var niz=[]; paste data inside the brackets

-below that paste the following code


var isFollower=function(s){
    var dobar=false;
    for(i=0;i<niz.length;i++) 
    {
        if(niz[i]===s) 
        {
            //dodat da obrise tog da manje trazi kasnije
            dobar=true;
            break;
        }
    }
    return dobar;
}
var unfollowPeople = function() {
        var x = document.getElementsByClassName("button slim hollow secondary ");
        var i;
        var unfollowCount = 0;
        for (i = 0; i < x.length; i++) {
            var t1 = x[i].parentElement;
            var t2 = t1.parentElement;
            t1=t2.nextSibling.innerText;
            if (x[i].innerHTML === 'Unfollow'&& isFollower(t1)==false) {
                unfollowCount++;
                x[i].click();
            }
            if (i == x.length - 1) {
                if (unfollowCount == 0) {
                    imdNextFollow();//manje treba sacekat ako nije nikoga unfollowao
                } else {
                    setTimeout(function() {
                        nexPage();
                    }, 20000);
                }
            }
        }
    }
var nexPage = function() {
    setTimeout(function() {
        var y = document.getElementsByClassName("button tiny hollow float-right");
        y[0].click();
        setTimeout(function() {
            unfollowPeople();
        }, 2000);
    }, 20000);
};

var imdNextFollow = function() {
    var y = document.getElementsByClassName("button tiny hollow float-right");
    y[0].click();
    setTimeout(function() {
        unfollowPeople();
    }, 2000);
}; 

unfollowPeople();

4.Now go to your's following page and open Browser console by pressing F12 and paste all the code from that new text document

5.Click Enter and this will automatically keep moving to next page and continue clicking the unfollow button for all people that are not your followers(are not in that array you created)

 NOTE: -This code could be more optimized and written to be fully automatic, but I just wanted to quickly write the code to automatically unfollow all my non followers

-If you want to see how to  automatically follow people from any steemit profile check this post(I edited that code to serve new purpose)

https://steemit.com/steemit/@sundarrajan/automatically-follow-people-from-any-steemit-profile

-This will reduce your remaining bandwidth which you can track at steemd.com/@your_username

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now
Logo
Center