Skip to content

ph3on1x/twitter_mass_delete

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Twitter Mass Delete

Bulk delete all your tweets from Twitter/X using your archive data.

Requirements

Installation

pip install twikit

Getting Your Twitter Archive

  1. Go to SettingsYour AccountDownload an archive of your data
  2. Request your archive and wait for Twitter to prepare it (can take 24-48 hours)
  3. Download and extract the archive
  4. Locate data/tweets.js inside the extracted folder

Usage

Dry Run (Preview)

See what would be deleted without actually deleting:

python twitter_mass_delete.py path/to/tweets.js --dry-run

Delete All Tweets

python twitter_mass_delete.py path/to/tweets.js

You'll be prompted to type DELETE to confirm.

Resume Interrupted Session

If the script stops (rate limit, network issue, etc.), resume where you left off:

python twitter_mass_delete.py path/to/tweets.js --resume

Options

Option Default Description
--cookies cookies.json Path to cookies file
--delay 1.5 Seconds between deletions
--dry-run - Preview without deleting
--resume - Resume from previous progress
--progress-file delete_progress.json Path to progress file

Authentication

Option 1: Interactive Login

Run the script and enter your credentials when prompted:

--- Twitter Login ---
Username or email: your_username
Password: (hidden)
Do you have 2FA enabled? (y/n): n

If you have 2FA with an authenticator app, you'll need the TOTP secret (the setup key, not the 6-digit code).

Option 2: Browser Cookies (Recommended)

If you get blocked by Cloudflare during login, use cookies from your browser instead.

  1. Log into x.com in your browser
  2. Open DevTools (F12)
  3. Go to Application tab → Cookieshttps://x.com
  4. Copy the values for auth_token and ct0
  5. Create cookies.json:
{
  "auth_token": "your_auth_token_value",
  "ct0": "your_ct0_value"
}
  1. Run the script — it will use these cookies automatically

Troubleshooting

Cloudflare Block / "You have been blocked"

Twitter's bot protection is blocking the login request. Use the browser cookies method described above.

Rate Limiting

The script handles rate limits automatically by waiting 60 seconds and retrying. If you're getting rate limited frequently, increase the delay:

python twitter_mass_delete.py tweets.js --delay 3.0

"No tweets found in archive"

Make sure you're pointing to the correct tweets.js file from your Twitter archive, not a different file.

Cookies Expired

Delete cookies.json and re-authenticate (either via login or by exporting fresh cookies from your browser).

How It Works

  1. Parses your Twitter archive (tweets.js) to extract tweet IDs
  2. Authenticates with Twitter using cookies or login credentials
  3. Deletes tweets one by one with rate limiting
  4. Saves progress periodically so you can resume if interrupted

License

MIT

About

Bulk delete all your tweets using your Twitter/X archive data

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages