Retoxing Twitter

For a few months, I experimented with blocktogether.org, a service that exploits the fact that users can export their Twitter block lists. Block Together allows you to publish who you block with a sharable link that lets others subscribe and instantly block whomever you block, and vice versa. So I joined, added my smallish list of trolls and subscribed to a few other accounts to see what would happen. The results were a mildly better user experience on Twitter, with a few manageable hangups along the way with false positives, and the entire list reached somewhere up around 890,000 users. Twitter doesn’t have an unblock-all button, and Block Together doesn’t have an Unblock Together companion, so how to do you go about it without hitting the unblock button thousands of times?


First: If you really just came here to do what I did, then here’s the part of this blog about how I did it.


Block Together has its use cases, but I also saw a darker side to it. Subscriber attacks can get a user to suddenly block thousands of accounts they might not want to. Some accounts included a few obvious bots, but then thousands of actual politicians, activists and others, who the person using it may not think are in the list. Or, your Twitter account could get hacked and and the person can just subscribe it to a block list in the shousands and block all the people who follow you as well as thousands of others.

Some will argue that Twitter’s an open platform so mass blocking is somehow a form of censorship. It’s not. Blocking is something we do all the time. You don’t listen to all sorts of things in your daily life. When  turn the channel on your TV you’re not censoring the channel you left. Listening to someone on the phone isn’t silencing everyone you’re not connected to at that time. Deciding not to interact with people isn’t censorship. You are not censoring everyone you aren’t friends with on Facebook, for example.

But there are other interesting toys to play with than blocking scripts. Twitter is more than a Speakers’ Corner. It has more than a hundred pieces of potential meta data with every single tweet a user publishes. There are some other tools I want to use to analyse really horrible Twitter accounts, and to do that, you need an API, and your account needs to be able to easily access those accounts. And then you have a laboratory endlessly full of test animals for experimentation.

How To unblock the flood of trolls

I used a Macbook for this, so a couple of bits of this are fairly specific to OSX, but you can find the same commands on Windows or Linux pretty easily. Also, Idid this in Chrome, but you can also open up a console in Firefox, so something similar may work there.

First, you want to load a bunch of accounts you’ve blocked. Go to your blocks in Twitter.

https://twitter.com/settings/blocked

Now that you’re there’ you can scroll down a few times to load more blocked accounts. This could be an exhausting tasks. Luckily, someone’s written some javascript about it.

First, open the console in your Chrome Browser. Once that’s open, start scrolling through your block list with this:

(function() {
 var intervalObj = null;
 var retry = 0;
 var clickHandler = function() { 
 console.log("Clicked; stopping autoscroll");
 clearInterval(intervalObj);
 document.body.removeEventListener("click", clickHandler);
 }
 function scrollDown() { 
 var scrollHeight = document.body.scrollHeight,
 scrollTop = document.body.scrollTop,
 innerHeight = window.innerHeight,
 difference = (scrollHeight - scrollTop) - innerHeight

if (difference > 0) { 
 window.scrollBy(0, difference);
 if (retry > 0) { 
 retry = 0;
 }
 console.log("scrolling down more");
 } else {
 if (retry >= 3) {
 console.log("reached bottom of page; stopping");
 clearInterval(intervalObj);
 document.body.removeEventListener("click", clickHandler);
 } else {
 console.log("[apparenty] hit bottom of page; retrying: " + (retry + 1));
 retry++;
 }
 }
 }

document.body.addEventListener("click", clickHandler);

intervalObj = setInterval(scrollDown, 500);

})()

This script will keep going, and going until it gets to the end of your list of blocked accounts. If you have more than 500, you’ll have to do it in batches. After you’ve loaded enough, clear the console with the 🚫 button in the console menu. Then go to your page of blocked Twitter trolls and hit the ⌘. combination. You may need to do this two or three times before the page gets the hint and stops.

Now you’re need the unblocking script by Jeff McGovern. You can get that here.

function sleep(ms) {
 return new Promise(resolve => setTimeout(resolve, ms));
}
function clickAll(buttons) {
 for (i = 0; i < buttons.length; i++) {
 buttons[i].click();
 }
}
async function unblock(timeoutMs, maxScrolls) {
 var prevScrollY;
 var scrollY = window.scrollY;
 var numScrolls = 0;
 do {
 window.scrollTo(0,document.body.scrollHeight);
 numScrolls++;
 prevScrollY = scrollY;
 await sleep(timeoutMs);
 scrollY = window.scrollY;
 } while((scrollY - prevScrollY) > 0 && (typeof maxScrolls === 'undefined' || numScrolls < maxScrolls));

var unblockButtons = document.getElementsByClassName("blocked-text")
 var actuallyBlock = confirm("Do you want to unblock all " + unblockButtons.length + " accounts?");
 if (actuallyBlock) {
 clickAll(unblockButtons);
 }
}
function main() {
 unblock(500);
}

To launch this script, you’ll next need to enter into the console:

main()

IMPORTANT: Do not re-run this script on the same page or you’ll end up following everyone you’re just trying to unblock, and you probably don’t like them that much. That’s because all this javascript is really doing is interacting with the button next to the people, so if it says “unblock,” that’s what it does. If it says “follow”, then that’s what it does.

Reload your page of blocked people in your browser. If there are still more blocked people to unblock, then repeat the process.

Leave a Reply

Your email address will not be published. Required fields are marked *

You can encrypt your comment so that only yours truly can read it.

WordPress Anti-Spam by WP-SpamShield