Twitter Bot Checker App Powered By Botometer

Photo by Morning Brew on Unsplash

A couple years back, I have written a short Python code that retrieves all the followers for a specific account and check for bots using Botometer. However, the Botometer has gone through some major changes which renders the original code obsolete. It is time to create something new!

Many new tools have become available since, including Streamlit. According to Streamlit’s developers:

Streamlit’s open-source app framework is the easiest way for data scientists and machine learning engineers to create beautiful, performant apps in only a few hours! All in pure Python. All for free.

Although it might be an overkill, I have decided to create a Streamlit app that serves as a wrapper over the new Botometer API. It essentially provides two simple functions: 1) Collect all the followers for a given account and store them in an SQLite database and 2) Loop through each account and post the data to the Botometer API and receive bot check data. SQLite database is natively supported by Python so no need to run a separate service.

How to use

Download and set up the Streamlit app

The app is built with Python 3.7.4 (although other Python versions such as 3.7.x and 3.6.x should also work). It is easier to start fresh with a new virtual environment (e.g. “conda create –name botcheck python=3.7” if you are using conda), then running:

git clone
cd twitter-bot-checker
pip install -r requirements.txt
streamlit run

Now, you should be able to see the app at: http://localhost:8501

Get the Twitter and Botometer Rapid API credentials

Please see this page for setting up the credentials. There is a free plan for testing that allows us to check up to 500 accounts per day. If you need more quota, their other paid plans would be ideal.

Use the app to retrieve followers and check for bots

  1. Select the JSON file that contains the Twitter and Botometer credentials. credentials.json is a template of the credential file, which can be found with the app. Credential loaded will be cached for later use.
  2. Provide an existing database. If not provided, the app will look for database in the temp folder. If no cached database available, a new database will be created.
  3. Specify the account whose followers need to be checked, and set the timeframe you want to keep the bot check data.
  4. Run “Retrieve Twitter followers”, which uses Tweepy API to retrieve all the followers of a specific account. If a database is provided or cached in the temp folder, the app will only add new followers that are not already in the database. If no database is available, the app will create a new database from scratch.
  5. Run “Check bot”, which call the Botometer Rapid API to check for bots in the database. It will not re-check the followers unless the bot data is expired. A download link will be available at the bottom of the sidebar when the process is completed. Alternatively, you can click the “Download bot check results” button to get the download link.

Demo Animation


Please check this section for the details of the output from bot check. You may also find this blog post and this paper from the developer of Botometer useful.

Data Scientist

I enjoy messing with R and Python code, building data products and visualisation tools.

comments powered by Disqus