Skip to main content

delete-tweets

PyPI version

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

  1. Create a Twitter Developer account:
    1. User profile: Use your current Twitter @username.
    2. 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.
    3. 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.
    4. Terms of service: Read and accept the terms.
    5. Email verification: Confirm your email address.
  2. Now wait for your Twitter Developer account to be reviewed and approved.

Create a Twitter app

  1. Create a new Twitter app (not available as long as your Twitter Developer account is pending review).
  2. Set 'Access permissions' of your app to Read and write.

Configure your environment

  1. Open your Twitter Developer's apps.
  2. Click the 'Details' button next to your newly created app.
  3. Click the 'Keys and tokens' tab, and find your keys, secret keys and access tokens.
  4. Now you need to make these keys and tokens available to your shell environment. Assuming you are using Bash:

⚠️ 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

  1. Open the Your Twitter data page
  2. Scroll to the 'Download your Twitter data' section at the bottom of the page
  3. Re-enter your password
  4. Click 'Request data', and wait for the email to arrive
  5. Follow the link in the email to download your Tweet data
  6. Unpack the archive

Getting started

Installation

Install the tool using pip.

python3 -m pip install delete-tweets

Usage

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

Metadata

Release files for delete-tweets 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for delete-tweets 2.0.1
File Size Uploaded Provenance Actions
delete-tweets-2.0.1.tar.gz 5.0 kB Without provenance Details for delete-tweets-2.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for delete-tweets 2.0.1
File Interpreter ABI Platform Actions
delete_tweets-2.0.1-py3-none-any.whl Python 3 none any Details for delete_tweets-2.0.1-py3-none-any.whl

Total release size: 11.0 kB

Release files / delete-tweets-2.0.1.tar.gz

Download URL delete-tweets-2.0.1.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
42b28abffd54687a38b1c779e8c65f248484bbf2262d202ec5d03c460be140d9
BLAKE2b-256 checksum
How to use checksums
e14bae92c00c39037ef37d18c0cd0e8190d9b95de7c89c3c831ec2070d88188d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3

Release files / delete_tweets-2.0.1-py3-none-any.whl

Download URL delete_tweets-2.0.1-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0e901de080dfb4304002d92bd9818140c6f58624b4853b3bd31e02d9f2255bb4
BLAKE2b-256 checksum
How to use checksums
ad3be3117ad8a9a20fb16761ab4b17d136f4bed9d196124c0a1b483fd5aaad52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3

Security for delete-tweets 2.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page