A script to archive a public Twitter account. It downloads all tweets as one JSON Lines file and all photos as JPEGs or PNGs.
It uses twarc under the hood.
You will need to sign up for a Twitter developer account, create a Project and an App, and get your App's key and tokens.
-
Install Python 3.
On Mac:
$ brew install python3
On Arch Linux:
# pacman -S python
-
Install this project's dependencies:
$ python -r requirements.txt
-
Get your Twitter App's bearer token (it should be somewhere here) and export it as an environment variable:
$ export BEARER_TOKEN='<your twitter app bearer token>'
-
Call this project's script with the username of the Twitter account you'd like to archive. Example:
$ ./archive-twitter-account TwitterDev
-
Done. You can now find the downloaded data in the
./data
directory. Example:data └── TwitterDev ├── media │ ├── Ffbx1jMXoAEU7Fh.jpg │ ├── ... │ └── FevXHTtXoAAoGyu.jpg ├── media_objects.jsonl └── timeline.jsonl
Feel free to remix this project under the terms of the Apache License, Version 2.0.