Automatically Unfollow non Followers on Steemit script

in steemit •  7 years ago 

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

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Thanks for sharing @emirk this looks really useful

I will have to make some time to try it! Not a programmer but I love tinkering with tech

You're welcome :)

Good post friend @emirk, congratulations for your good post, greetings and happy evening

Thank you very much :)

Congratulations @emirk! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes received

Click on any badge to view your own Board of Honor on SteemitBoard.

To support your work, I also upvoted your post!
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

Upvote this notification to help all Steemit users. Learn why here!

Can you add a delay after each follow? Otherwise it keeps giving errors.

Yeah please if it possible add delay!

Loved that post 😀 written in English it sh and there were words I understood, but stringing them together like so, left me behind after first sentence. No idea what any of it means, so I'll have to pass. I don't have a cpu and the only sites I use are apps like bank and TV guide and sometimes weather radar. 😆 even this site, I don't know too much on how to use.