Tools for fighting abuse on Twitter
Please note that this project is now developed on GitLab, and will only temporarily be mirrored to GitHub. GitLab is garbage but for the moment at least GitHub is even worse.
This repository contains some low-tech tools designed to help you make Twitter a nicer place for yourself. Some of these tools might also be useful in other ways, like for example if some litigious person with a long history of making common cause with white supremacists and misogynists threatens to sue you for defamation.
One of the things this project provides is a command-line tool that takes a Twitter screen name and outputs a list of all of the accounts you've blocked that that account follows (sorted here by follower count):
$ cargo build --release Finished release [optimized] target(s) in 0.06s$ target/release/twcc blocked-follows sfscala @jdegoes 11807 @rolandkuhn 9238 @propensive 8323 @etorreborre 7045 @ChiefScientist 5450 @dibblego 3587 @nuttycom 3307 @kubukoz 2808 @scalaworldconf 2495 ...
I get a lot of hate-follows, and this tool makes it much easier for me to decide which new followers I need to block. It's like a version of Twitter's "Followed by… and 123 others you follow" that's actually useful.
I sometimes work in a certain programming language community where prominent community members have a tendency to say abusive or exclusionary things and then delete and deny everything when they're confronted, so the CLI also provides a way to search the Wayback Machine for deleted tweets by a specified user:
$ target/release/twcc deleted-tweets --limit 100 jdegoes https://web.archive.org/web/20190922222236/https://twitter.com/jdegoes/status/1170420726400212997 https://web.archive.org/web/20190923221242/https://twitter.com/jdegoes/status/1170711737361940481 https://web.archive.org/web/20200526150339/https://twitter.com/jdegoes/status/1265251872048320513
In this case we've limited the search to the 100 tweets most recently archived by the Wayback Machine.
You can also use this command to generate a Markdown-formatted report instead of a simple list of links:
$ target/release/twcc deleted-tweets --report ChiefScientist
Which currently generates this document.
It can also print a list of everyone you currently block, follow, or are followed by, it can get the URL of a deleted tweet from the URL of a reply, and it can partition a list of tweet IDs by their deleted status.
twcc 0.1.0 Travis BrownUSAGE: twcc [FLAGS] [OPTIONS]
FLAGS: -h, --help Prints help information -v, --verbose Level of verbosity -V, --version Prints version information
OPTIONS: -k, --key-file TOML file containing Twitter API keys [default: keys.toml]
SUBCOMMANDS: blocked-follows For a given user, list everyone they follow who you block check-existence Checks whether a list of status IDs (from stdin) still exist deleted-tweets Lists Wayback Machine URLs for all deleted tweets by a user follower-report For a given user, print a report about their followers help Prints this message or the help of the given subcommand(s) import-blocks Blocks a list of user IDs (from stdin) list-blocks Print a list of all users you've blocked list-followers Print a list of all users who follow you (or someone else) list-friends Print a list of all users you (or someone else) follows list-tweets Print a list of (up to approximately 3200) tweet IDs for a user lookup-reply Get the URL of a tweet given the URL or status ID of a reply
The
twshootcommand-line tool can take a screenshot of a tweet, given either a URL or status ID:
$ cargo build --release Finished release [optimized] target(s) in 0.29s$ target/release/twshoot https://twitter.com/travisbrown/status/1291256191641952256
And then you have a
1291256191641952256.pngfile in the current directory that looks like this:
The application also generates a
-full.pngimage showing the entire browser screen. The image sizes, output directory, etc. are configurable (see
twshoot --helpfor details).
This tool doesn't require a Twitter API account, but you do have to have ChromeDriver running (it also works with GeckoDriver, but the results don't look as nice).
You'll need to install Rust and Cargo.
Once you've got those, you can run
cargo build --releaseand the binaries will be available in the
target/releasedirectory.
For the main
twccapplication, you'll need Twitter API access for your Twitter account, and you'll need to provide the necessary keys in a file (by default
keys.toml):
[twitter] consumerKey="****" consumerSecret="****" accessToken="****" accessTokenSecret="****"
Some of the other tools require a WebDriver server instead of API access. These should work with either ChromeDriver or GeckoDriver.
The project also contains some other miscellaneous stuff, including a way to export your Twitter block list even if you don't have a Twitter API account, and a way to search the Wayback Machine even if the CDX server isn't working.
It doesn't currently include a few related tools I use regularly, including a way to block everyone who retweeted or favorited a given tweet, a bunch of stuff related to Wayback Machine ingestion and downloading, and some scripts that bundle some of the follower functionality into daily reports.
Most of these things are excluded for one of the following reasons:
I might add some of them eventually.
Nothing here is very polished or robust. These applications don't keep track of rate limits in all cases, for example, so if you run out of requests for an endpoint, they may just crash, and you'll have to wait. I might try to smooth out some of these rough edges at some point, but it's unlikely.
This project is licensed under the Mozilla Public License, version 2.0. See the LICENSE file for details.