Created
April 17, 2020 22:36
-
-
Save sonerb/015f44d340f4d452ea2082f4d19b5618 to your computer and use it in GitHub Desktop.
This script unfollow your followings except your followers for Twitter.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
users = document.querySelectorAll("div[data-testid$=-unfollow]"); | |
user_idx = 0; | |
function callReload() | |
{ | |
users = document.querySelectorAll("div[data-testid$=-unfollow]"); | |
user_idx = 0; | |
callClick(); | |
} | |
function callClick() | |
{ | |
if (user_idx < users.length) | |
{ | |
user = users[user_idx++]; | |
if (user.parentElement.parentElement.querySelectorAll("div > div > div > a > div > div:nth-child(2) > div").length == 1) | |
{ | |
user.click(); | |
setTimeout(callUnfollow, 100); | |
} | |
else | |
{ | |
callClick(); | |
} | |
} | |
else | |
{ | |
window.scrollTo(0,document.querySelector("body").scrollHeight); | |
setTimeout(callReload, 250); | |
} | |
} | |
function callUnfollow() | |
{ | |
if (document.querySelector("div[data-testid=confirmationSheetConfirm]") != null) | |
{ | |
document.querySelector("div[data-testid=confirmationSheetConfirm]").click(); | |
setTimeout(callClick, 100); | |
} | |
else | |
{ | |
setTimeout(callClick, 100); | |
console.log('I can\'t found unfollow button'); | |
} | |
} | |
callClick(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment