Delete tweets from your Twitter timeline.
Project description
delete-tweets
This is a simple script that helps you delete tweets (or just replies or retweets) from your timeline. There are quite a few third-party services that allow you to delete tweets, but these very likely will not allow you to delete tweets beyond the infamous 3,200 tweet limit.
Prerequisites
Unfortunately, as of late 2018, you are required to have a Twitter Developer account in order to create a Twitter app.
Apply for a Twitter Developer account
- Create a Twitter Developer account:
- User profile: Use your current Twitter @username.
- Account details: Select I am requesting access for my own personal use, set your 'Account name' to your @username, and select your 'Primary country of operation.
- Use case details: select 'Other', and explain in at least 300 words that you want to create an app to semi-automatically clean up your own tweets.
- Terms of service: Read and accept the terms.
- Email verification: Confirm your email address.
- Now wait for your Twitter Developer account to be reviewed and approved.
Create a Twitter app
- Create a new Twitter app (not available as long as your Twitter Developer account is pending review).
- Set 'Access permissions' of your app to Read and write.
Configure your environment
- Open your Twitter Developer's apps.
- Click the 'Details' button next to your newly created app.
- Click the 'Keys and tokens' tab, and find your keys, secret keys and access tokens.
- Now you need to make these keys and tokens available to your shell environment. Assuming you are using Bash:
:warning: Before you continue, you should be aware that most shells record user
input (and thus secrets) into a history file. In Bash you could prevent this by
prepending your command with a single space (requires $HISTCONTROL
to be set
to ignorespace
or ignoreboth
).
export TWITTER_CONSUMER_KEY="your_consumer_key"
export TWITTER_CONSUMER_SECRET="your_consumer_secret"
export TWITTER_ACCESS_TOKEN="your_access_token"
export TWITTER_ACCESS_TOKEN_SECRET="your_access_token_secret"
Get your tweet archive
- Open the Your Twitter data page.
- Scroll to the 'Download your Twitter data' section at the bottom of the page.
- Re-enter your password.
- Click 'Request data', and wait for the email to arrive.
- Follow the link in the email to download your Tweet data.
- Unpack the archive, and move
tweet.js
to the same directory as this script.
Getting started
Local
First, install the required dependencies.
pip install delete-tweets
Then, for example, delete any tweet from before January 1, 2018:
delete-tweets --until 2018-01-01 tweet.js
Or only delete all retweets:
delete-tweets --filter retweets tweet.js
Spare tweets
You can optionally spare tweets by passing their id_str
, setting a minimum amount of likes or retweets:
delete-tweets --until 2018-01-01 tweet.js --spare-ids 21235434 23498723 23498723
Spare tweets that have at least 10 likes, or 5 retweets:
delete-tweets --until 2018-01-01 tweet.js --spare-min-likes 10 --spare-min-retweets 5
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file delete-tweets-1.0.1.tar.gz
.
File metadata
- Download URL: delete-tweets-1.0.1.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf9dbfad159f23b1ce497982c6782460e3353b8256baad92fe63ee83e6fa0a84 |
|
MD5 | 08f9cdd38d61b9c265f6f2397c14e79b |
|
BLAKE2b-256 | faa7347d0d42c0350f73b6392ff38b9859f2950cf7faef6e380d6d9d9c81eafc |
File details
Details for the file delete_tweets-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: delete_tweets-1.0.1-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4bcb4b23e24e898e1a4541b2b7d1c6c9c8b4ed573badc9bbc6e38098068d9534 |
|
MD5 | ba3bf3f4263288f1077539f1a0f3b477 |
|
BLAKE2b-256 | 7d5a6b8891545782036ed2809781953cefcd9fdd831b4ab82058eb8a1d0d0171 |