I Wish I didn't have to write this.
I still get bitten by twitter's "unfollow bug", where people I'm following disappear from my "friends" list.
This tiny app is intended to run on a schedule, and simply notifies you when your twitter "friends" list changes.
Me, well, I run this as a nightly cron job on a server that I use for other things.
It uses the twitter API to fetch your friends. It stores them in a file.
The next time it runs, it does the same thing, and then checks to see if there were any differences.
This is lame but I like it anyways: If a user changes their name, location, or description, they'll show up in here as well. The lame part is that it will show them as being both added and deleted. I wrote this in an afternoon after mowing.
So if you follow someone new, unfollow someone intentionally or otherwise, or if one of your twitter homies changes some of their stuff, it'll tell you.
You really have to be annoyed by this if you want to read further and maybe even try to use this yourself.
This is written in Google Go.
If you're familiar with Go and want to build from source:
go get github.com/marcesher/twitter_friend_changes
In a bit, after configuration, you can go build
, or go run main.go
Check out the Releases section of this repo for some pre-build binaries for Linux, Mac, and Windows. You do not need the Go toolchain when using binaries.
If you pulled down the source:
cp config_sample.json config.json
If you're using a binary, then create a file in the same directory as the binary you downloaded, name it config.json
,
and paste in the contents of config_sample.json
that you see in this repository.
Open config.json
in an editor. You're going to put stuff in here.
Go to https://dev.twitter.com/oauth/overview/application-owner-access-tokens and set up a new app.
It'll create 4 things you'll need:
- Consumer Key
- Consumer Secret
- Access Token
- Access Token Secret
Populate the appropriate fields in config.json
with those values
If you want this thing to email you, hooboy, you're in for it. I can't walk you through creating an AWS account, configuring it, getting keys, etc. Well, I could, but I won't.
So, go do that, and get yourself an AWS_ACCESS_KEY_ID and AWS_SECRET_KEY, and configure SES to be able to send email from an email address.
Side note: If you can do ^^^ that, put "DevOps" on your resume and hunker down for the LinkedIn Recruiter Horde.
- In
config.json
set the from and to email addresses - When you run this application, set those AWS... values as environment variables, like:
$ AWS_ACCESS_KEY_ID="..." AWS_SECRET_KEY="..." ./twitter_friend_changes
$ ./twitter_friend_changes
Will run the thing, read your config file, and spit stuff out.
If you want to send emails, assuming you've endured the above indignities:
$ AWS_ACCESS_KEY_ID="..." AWS_SECRET_KEY="..." ./twitter_friend_changes
I use this crontab:
0 6 * * * cd /var/www/twitter_friend_changes && AWS_ACCESS_KEY_ID=... AWS_SECRET_KEY=... ./twitter_friend_changes >> twitter_friend_changes.log