Skip to content

Bulk-delete tweets (and unlikes) on X from the browser console using web GraphQL. Date/keyword/ID filters, archive import, rate-limit aware.

Notifications You must be signed in to change notification settings

McKenzieJDan/DeleteTweets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

DeleteTweets

Browser console helper for tidying tweets and likes on X. You stay in control because it reuses the same GraphQL calls the site already makes.

Deleted tweets and removed likes do not return. Test with a spare account first and keep the tab focused while the script runs.

Overview

  • Script lives in main.js.
  • You paste it into DevTools to run it.
  • You decide filters and date ranges before each run.

Before you start

  1. Clone the repo or download the script.
  2. Open main.js in your editor.
  3. Sign in to https://x.com in a desktop browser.
  4. Open DevTools → Network and capture the following from authenticated requests:
    • authorization header (Bearer token).
    • client_tid header (x-client-transaction-id) that matches live timeline calls.
    • client_uuid header. Leave it as an empty string if the header is missing.
    • GraphQL resource IDs:
      • UserTweetsAndRepliesgraphQLResources.tweetsAndReplies.
      • UserTweetsgraphQLResources.tweetsOnly.
      • Likesrandom_resource_likes.
    • Unlike helpers if you plan to remove likes:
      • UnlikeTweet query ID → unlike_query_id.
      • x-client-transaction-id for the unlike call → unlike_transaction_id.
    • Your handle for the username field (no leading @).

Configure main.js

  1. Paste the captured values over the placeholders near the top of the file. Do not commit private tokens.
  2. Leave client_uuid as "" when the header is absent.
  3. Update delete_options to describe the run:
    • Set from_archive to true when you want to load tweets.js.
    • Add pinned tweet IDs to tweets_to_ignore.
    • Use delete_specific_ids_only or unlike_specific_ids_only to target exact tweets.
    • Set match_any_keywords, after_date, before_date, and delete_message_with_url_only as needed.
    • Turn on remove_likes only when you also captured the unlike headers.

Run in the browser

  1. Keep DevTools open on the Console tab.
  2. Paste your edited main.js into the console.
  3. Press Enter once to launch the workflow.
  4. When from_archive is true, drop tweets.js into the modal and click Confirm.
  5. Watch the console for progress messages such as found …, 12/200, or unliked 5/20.

Filters and safeguards

  • tweets_to_ignore wins over every other filter.
  • match_any_keywords is case-sensitive. Normalise inputs if needed.
  • after_date and before_date use your local time zone. Set both for a bounded window.
  • delete_message_with_url_only combines well with keywords to target link posts.
  • stop_signal halts loops when the timeline returns items outside your window. Adjust the filters and run again.

Common issues

  • 404 responses usually mean a stale GraphQL resource ID or transaction ID. Capture fresh values from Network and rerun.
  • 401 or missing cookie errors mean the session expired. Reload x.com, confirm you are logged in, and update authorization.
  • Repeated 429 responses signal rate limits. Let the script wait, or split the job into smaller segments.
  • Placeholders such as "REPLACE_WITH_LIKES_RESOURCE" cause early exits. Fill them or disable the related feature.

Contributing

Send pull requests when you improve the script. Follow the guidance in AGENTS.md, use Conventional Commits, and never include personal tokens.

License

No license is provided. Use the code only if you accept that risk.

About

Bulk-delete tweets (and unlikes) on X from the browser console using web GraphQL. Date/keyword/ID filters, archive import, rate-limit aware.

Topics

Resources

Stars

Watchers

Forks