Twitter Followers and List Membership Tracking

I was curious to track how my Twitter account’s followers and my account’s list memberships changed over time. The results of my tracking are on this webpage.

Twitter Followers – Twitter followers are other Twitter accounts who follow my account. A Twitter Follower may follow my account for a few days and then unfollow me at any time afterwards.

Twitter List Memberships  – Twitter accounts can also create their own Lists and then add other Twitter accounts to the lists. For example a Twitter account may create a List called “Tweet about Big Data” to track Twitter accounts they believe “Tweet about Big Data”. Twitter accounts may add my account to their List and remove it at any time afterwards.

Twitter doesn’t provide historical data so you have to keep track of this yourself by retrieving and saving daily data but then you can compare daily changes to track new, active and dropped followers and list memberships.

To get the data from Twitter I created two Python scripts to run each night using Twitter’s API and Python’s Tweepy package.

These scripts retrieve my Twitter account’s followers and list memberships and insert the data into a MySQL database table along with a timestamp.

This table is then queried to get follower and list membership counts by timestamp date to get counts of new, active and dropped followers and list memberships by date.

The Twitter data retrieval, writing to database, and data querying are all done on a web server.

The query results are saved as csv files which are transferred from the web server to an AWS S3 folder so they can be used in an AWS S3 static website visualizations.

The AWS S3 static website is an AWS S3 folder with HTML, CSS, csv, javascript files configured to serve the files as a website. jQuery is used to read the csv files and Javascript charting library Chart.js to chart data.

Here is the chart showing active followers by day, with counts of new follows and un-follows by day.


This chart shows active list memberships by day, with counts of new listings and un-listing by day:


The code for this will be posted soon.

2 Thoughts on “Twitter Followers and List Membership Tracking

  1. Matteo M on June 23, 2017 at 8:47 am said:

    HI Curtis,

    This is an amazing post!

    I was wondering if you had, by any chance, posted the Python code somewhere!

    I am trying to learn more about Twitter APIs and this would be an amazing personal project!

    Thank you for your help,

    Matteo from Italy

  2. Curtis on August 24, 2017 at 11:36 pm said:

    Thanks Matteo. I haven’t gotten around to including the Python code in this site.

    But check out other posts I have that include Twitter API Python code that might be interesting for you too!

    I have learned most of what I need to use the Twitter API through searching other people’s blogs and StackOverflow. I have had to modify almost all of the code on my own though once I found other people’s code.

    Conceptually it is pretty straightforward but the details as always make it a bit more challenging.

    First you need Twitter Developer account which can be same user as any regular Twitter account. Then you need to create API keys that will uniquely identify you to the Twitter API. Depending on what you are doing you may also be required to setup authentication.

    I recommend using Tweepy which is Python module that is made to interact with Twitter API. You then have to just learn how to use Tweepy rather than interact with Twitter API directly which makes it easier.

    Good luck!

Leave a Reply

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

Post Navigation