Skip to content

Instantly share code, notes, and snippets.

@jkmcnk
Last active October 3, 2023 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkmcnk/3dff4d43f418951427235c0012a26034 to your computer and use it in GitHub Desktop.
Save jkmcnk/3dff4d43f418951427235c0012a26034 to your computer and use it in GitHub Desktop.
unfollow everybody on twitter
/* go to the list of accounts you follow:
*
* https://twitter.com/username/following
*
* open the browser javascript console and paste the following in, followed by a ctrl+enter
*/
function clickConfirm() {
var goon = 0;
var divs2 = document.getElementsByTagName("div");
goon = 0;
for(var i = 0; i < divs2.length; i++) { var lbl = divs2[i].getAttribute("data-testid"); if(lbl != null && lbl.startsWith("confirmationSheetConfirm")) { console.log(divs2[i]); divs2[i].click(); goon = 1; } }
if(goon) {
setTimeout(clickConfirm, 100);
} else {
setTimeout(clickUnfollows, 100);
}
}
function clickUnfollows() {
var goon = 0;
var divs = document.getElementsByTagName("div");
for(var i = 0; i < divs.length; i++) { var lbl = divs[i].getAttribute("aria-label"); if(lbl != null && lbl.startsWith("Following ")) { console.log(divs[i]); divs[i].click(); goon = 1; } }
if(goon) {
setTimeout(clickConfirm(), 100);
} else {
window.onload = clickUnfollows();
window.location.href = window.location.href;
}
}
window.onload = clickUnfollows();
window.location.href = window.location.href;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment