Skip to content

Instantly share code, notes, and snippets.

@aeschright
Created March 11, 2015 05:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aeschright/a348c13e77818651728d to your computer and use it in GitHub Desktop.
Save aeschright/a348c13e77818651728d to your computer and use it in GitHub Desktop.
Force everyone not on a twitter list to unfollow you
After you install and set up the twitter command line tool at https://github.com/sferik/t this script can be used to remove all followers not on a list (called "trusted" in this example). This is useful if you have a public twitter account and you change it to be private.
#!/bin/sh
#set -x
trusted=$( t list members trusted )
followers=$( t followers )
follower_list=$( echo $followers | tr " " "\n" )
i=0
for follower in $follower_list; do
if [[ ! "${trusted}" =~ "${follower}" ]]; then
echo $follower >> removed_followers
t block $follower
t delete block $follower
i=$(($i + 1))
fi
done
echo "${i} users are no longer following you"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment