Using the Twitter API, this Python3 script will output a CSV file for friends (who a user is following), followers (who follows the user), or both.
This repo is based on code made in a tutorial by Brienna Herold: How to Download Twitter Followers or Friends for Free
Requirements: Python 3, pip3, Tweepy and Pandas Python libraries, Twitter API credentials
This has been tested with Python 3.10.7, Tweepy versions 4.4.0 and 4.12.1, and Pandas versions 1.3.4 and 1.5.1.
- Clone this repository
- Install dependencies Tweepy and Pandas:
pip3 install -r requirements.txt
- Execute the Python script with a username and optional type. Type can be
followers
,friends
, orboth
, but defaults tofollowers
. Either shortened or spelled out arguments are acceptable, like so:
python3 download_friends_or_followers.py -u username -t [type]
python3 download_friends_or_followers.py --user username --type [type]
Please be aware of the Twitter API rate limits. This script fails if limits are exceeded.
Original code is by Brienna Herold. All changes by Michael Weinberg are dedicated to the public domain in accordance with CC0 1.0 Universal.