Delete your tweets older than X days
Using the Twitter API (V2) we get your tweets older than a certain date (max 50 tweets at a time) and delete them.
OAuth 2.0. is used as an authentication method. To initially obtain a refresh token we first boot a server which authorizes the application and retrieves the refresh token for the first time.
The script scrub.py
uses that refresh token to obtain a valid token to delete
tweets. A rolling copy of the refresh token is kept.
- Create a new project and application in the Twitter Developer Portal
- Rename
env.example
to.env
. - Copy the
API_KEY
,API_SECRET
andBEARER_TOKEN
value over to.env
file. - Under the application edit the "User Authentication Settings" to
- Under OAuth 2.0 Authentication make it a Native App.
- Under App info, make the callback URL
http://127.0.0.1:8000/oauth/callback
- Click save, and copy the
CLIENT_ID
andCLIENT_SECRET
over to the.env
file. - In your terminal, boot the server via
make start-server
. Install all deps specified inrequirements-server.txt
before doing so. - In your browser, navigate to http://127.0.0.1:8000 and authorize the application
- A refresh token will be saved to a file
.data/.refresh_token
- Complete the other missing fields such as
TWITTER_HANDLE
andDAYS_TO_KEEP
- Run the scrubber script via
make run-docker