DEV Community

Arun Kumar
Arun Kumar

Posted on • Updated on

How I "Unfollowed All" in twitter...

tldr;

var lst = document.querySelectorAll('section .css-1dbjc4n > .css-1dbjc4n > div.css-18t94o4');
var arr1 = [];
lst.forEach(x => arr1.push(x));
arr1.map(x => x.click());

This script will trigger click event for all the Unfollow button in following page of twitter.

Hey everyone, hope you are having a great day.
So today I logged into my long abandoned twitter account and found myself following a lot of people whom I didn't know. Hmmm... very suspicious. I found that some random apps had access to my account so maybe they did it. Whatever the scenario I wanted to unfollow everyone. Of course twitter developers made the process of unfollowing VERY painful by adding a confirmation popup and no option to do a quick "Unfollow All". So this left me with no choice but to tinker with developer tools...

"Back to hardware mode"

I tried googling but no answer worked for me. Out of desperation I created the above script to trigger click event on all Unfollow button concurrently so all the confirmation popups will open one after another. It still required me to click 132 times on the confirmation button but still it was easier. I hope this helps anyone else who is trying to do this same thing and is frustrated by not having a "unfollow all" button...

Have a good day..

Top comments (1)

Collapse
 
lupus_miles profile image
Astral Lupus Miles • Edited

ok it worked a little too well and got me a 3 day ban xD

that being said i was using this to unfollow over 3000 twitter accounts along witha program that simulated the end key being pressed on my keyboard to load more accounts, automatically pasting the script into the firefox control panel and then clicking 10 times a second on the confirmation dialogue box that opened up.

but i suspect it was the particular script given what it does if you run it with a lot of "follow" buttons on screen rather than "unfollow" ones.