---
title: "Following-of-following monitor"
description: "A Python script that takes daily snapshots of whom the accounts I follow are following, and reports what changed."
date: 2021-12-31T12:54:31+01:00
lastmod: 2026-10-16T18:58:52+02:00
url: https://klimek.link/projects/twitter-follow-diff/
author: "Marcin Klimek"
source: https://klimek.link/projects/twitter-follow-diff/
---

# Following-of-following monitor

I wrote this small Python script against the Twitter API v2 (through tweepy) to answer one question: whom did the people I follow start or stop following?

- It fetches the list of accounts followed by one account, then, for each of those, the accounts *they* follow.
- Each list is saved as JSON in a folder named after the date.
- Every run compares the newest snapshot with the previous one and writes a plain-text report: for each followed account, who was added and who was removed.
- User IDs are turned into names through a local cache that is filled in from the API as needed.

*Diagram: From the follow lists to the text report*

To stay within the API rate limits, the script refetches a user's list only when the saved copy is older than three hours, and the root list once a day.

Source: https://klimek.link/projects/twitter-follow-diff/
