Giter Club home page Giter Club logo

deletetweets's Introduction

Disclaimer

It should work just fine, I regularly use the script myself, but if anything wrong happens I am not taking any responsibility. Do not use this script if the 0.1% possible failure scares you.

Prerequisites

I use Google Chrome. I don't know if it will work elsewhere. It probably will, but if it doesn't, just try on Chrome.

Tutorial

(if you can't find the uuid, put any value it'll work)

Video Tutorial

deletetweet.mp4

Text Tutorial

  • Go to https://twitter.com/
  • Open the DevTools by pressing CTRL + SHIFT + I
  • Click on Network tab in the DevTools console
    • If requests are not being recorded, press CTRL + E and wait 5 seconds
  • You should now have something like this : ULXBFrT
  • Click on Fetch/XHR : KtZYL0L
  • Now click on any request in the results, and look for the authorization/X-Client-Transaction-Id/X-Client-Uuid values, as in screenshot: pxN8nth
  • Now replace the values in the .js from this repository of the according variables, by the values of the three variables you found, here is an example of how it should look in the end : E0M6Bf9

Filtering / Options

  • You can now choose to delete only tweets that are within a specific date range. For this, edit "before_date" and "after_date" in the delete_options variable. These will look like that :
	"after_date":new Date('1900-01-01'), // year-month-day
	"before_date":new Date('2100-01-01') // year-month-day

Say you want to delete tweets that happened on July 3rd 2023. You would set the date to that :

	"after_date":new Date('2023-07-02'), // year-month-day
	"before_date":new Date('2023-07-04') // year-month-day

It means : Delete tweet AFTER July 2nd 2023, and BEFORE July 4th 2023. These two dates are not included, so it's only what's in-between these dates, and what's before 2nd and 4th, you got it, 3rd. NOTE: This is not optimized at all. Meaning the script will go through ALL of your tweets no matter what date you gave. It will only delete tweets that are in the date range you gave, but it will go through all tweets. I will try to optimize it later.

  • You can filter which tweets to delete by editing the delete_options variable. For now you can decide to remove tweet that contain a certain keyword. For example if you want to delete tweets that contain the word "Hi" or "Hello"(case sensitive), change the variable to look like that :
var delete_options = {
	"delete_message_with_url_only":false,
	"match_any_keywords":["Hi", "Hello"]
}
  • You can also choose to remove tweets only if they contain a link in them. Just change delete_message_with_url_only to true. You can combine this option with the keywords option.
  • Edit 25/08/2023, you can now add tweet ids that you want to keep, so they won't get removed. It's the "tweets_to_ignore" property in the delete_options variable. Just add the tweet id in the array
  • Edit 29/08/2023, you can now choose to also unretweet or not, by changing the "unretweet" property in the delete_options variable. Set it to true if you want to unretweet. It combines with the other filters.
  • Edit 10/09/2023, IF the script removed some tweets but not all, AND that there were no error thrown, then you can set the option "old_tweets":false to true in the delete_options object. Then launch the script again, and it should delete these older tweets.
  • Edit 06/10/2023, new delete_options : do_not_remove_pinned_tweet, it is set to true by default so you don't remove your pinned tweet by mistake.
  • Edit 07/10/2023, added "delete_specific_ids_only" option. Override the default tweet search, and only remove tweets from their IDs that you have put in this option(it's an array)
  • Edit 07/12/2023, added from_archive option. It's WAY faster, no rate-limit, and it's more complete. Download your archive from Twitter then enable from_archive by setting it to true in the script, then you'll see a box asking you to drag your tweets.js file in it.

Now copy/paste the script in the console, press Enter, and wait for the deletion to complete. It should write "DELETION COMPLETE" in the console when it's over. When it's over, launch the script a second time, there sometime are a few leftovers.

Support

I allow tickets in French 🇫🇷 but prefer English if you can speak it, so everyone can understand.

FAQ

Do I need to include the Bearer part of the authorization key ?

Yes

I can't find X-Client-Transaction-Id/X-Client-Uuid/authorization

In the request list, search for requests named client_event.json, they are the more frequent ones, and they always contain the tokens you need

Uncaught TypeError: entries is not iterable

If you have this error, in the script edit the random_resource variable from var random_resource = "uYU5M2i12UhDvDTzN6hZPg"; to var random_resource = "Q6aAvPw7azXZbqXzuqTALA";

Then go to the fetch_tweets() function and change the feature variable to:

var feature = `&features=%7B%22responsive_web_graphql_exclude_directive_enabled%22%3Atrue%2C%22verified_phone_label_enabled%22%3Afalse%2C%22creator_subscriptions_tweet_preview_api_enabled%22%3Atrue%2C%22responsive_web_graphql_timeline_navigation_enabled%22%3Atrue%2C%22responsive_web_graphql_skip_user_profile_image_extensions_enabled%22%3Afalse%2C%22tweetypie_unmention_optimization_enabled%22%3Atrue%2C%22responsive_web_edit_tweet_api_enabled%22%3Atrue%2C%22graphql_is_translatable_rweb_tweet_is_translatable_enabled%22%3Atrue%2C%22view_counts_everywhere_api_enabled%22%3Atrue%2C%22longform_notetweets_consumption_enabled%22%3Atrue%2C%22responsive_web_twitter_article_tweet_consumption_enabled%22%3Afalse%2C%22tweet_awards_web_tipping_enabled%22%3Afalse%2C%22freedom_of_speech_not_reach_fetch_enabled%22%3Atrue%2C%22standardized_nudges_misinfo%22%3Atrue%2C%22tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled%22%3Atrue%2C%22longform_notetweets_rich_text_read_enabled%22%3Atrue%2C%22longform_notetweets_inline_media_enabled%22%3Atrue%2C%22responsive_web_media_download_video_enabled%22%3Afalse%2C%22responsive_web_enhance_cards_enabled%22%3Afalse%7D"`

And it should work :) Also I updated the script on 5/09/2023 so if you got the script before that date, it's most likely outdated and you need to get the new one.

Other

https://ko-fi.com/lolarchiver# if you feel like it :D

deletetweets's People

Contributors

lyfhael avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

deletetweets's Issues

doesn't delete threads

my page looks empty but it says that i still have over 4000 tweets. when i log onto another account and look at the page i can see some of the tweets and i realize that they're all replies to myself. the original tweets are gone but the rest of the threads are still there.

[Suggestion] Filter by date

Hi, thanks for this project.
It would be really great if one could filter the tweets to delete depending on the date. For example, being able to set a rule like «delete all the tweets older than 6 months».

"old tweets" and date ranges apparently don't work together

I was having trouble getting tweets before 2023 to delete, so enabled old_tweets along with my before_date=2023-01-01. After the script ran, pretty much all of my tweets/replies/retweets were gone (it somehow missed a few from the last couple weeks).

Error when running script: VM173:122 Uncaught TypeError: entries is not iterable at log_tweets (<anonymous>:121:19) at <anonymous>:264:15

When the script is run in the console, it returns with the following error:

VM173:122 Uncaught TypeError: entries is not iterable at log_tweets (<anonymous>:121:19) at <anonymous>:264:15

Below is a copy of the script as I had run it, with my own values removed:

https://pastebin.com/0F61S1LE

All of my inputs corresponded to the IDs specified in the comments. Beyond that, no changes have been made to the script. Replicated 10 times on Chromium 116.0.5845.110 on Ubuntu 22.04.

Unlike tweets

Hi! thanks for this script. It worked great to delete all my tweets. I would love to do the same but to unlike all the tweets I've liked.

Debugging connection was closed | Reason: render process gone error

Okay. I have A LOT of tweets to erase. More than 250K tweets so my archive tweets.js are divided in at least 5 more parts, each with a size of 100M.

The thing is, the script will consistently erase only 16379 of the N tweets present on the archive since after reaching that number the Chrome tab will crash with the next message:

debugging connection was closed | reason: render process gone
Screenshot 2024-05-04 145649

I've been able to keep deleting my tweets running twitter_archive_content = twitter_archive_content.slice(0,-16378); a couple times after each crash. I think that a quick solution could be adding an option to set the number of tweets from which where to start the tweet deletion loop counter, so that one could continue from where it stopped last time. I could do a PR with the fix if needed.

PS: Thanks for the script! it works wonders and it's pretty easy to follow.

Removing likes in the same way

Hi,

This is actually not an issue but an idea. I am wondering if we can achieve the same thing to remove likes using https://twitter.com/i/api/graphql/ZYKSe-w7KEslx3JhSIk5LA/UnfavoriteTweet api.

Best regards.

no errors but tweets not deleting

running on chrome. using a date range, with tweet exclusions, old tweets set to true. seems like it's running just fine from what i can tell, but my tweet count stays exactly the same no matter what i change.
image

i'm not super knowledgeable on coding so sorry if there's a really simple fix!

How do I run this script?

Apologies for something so immensely stupid, but it's my first time with javascript.

I have followed the howto, replaced the auth token, set the settings.

Now how do I actually run this code? Do I paste it into the browser console? Or run with node.js? Or with tampermonkey?

Is there some button to load a local file in chromium?

Suggestion: Language check

In async function delete_tweets, you set client language as fr. You can remind us to change it or make that string a variable that we can fill (and define widespread languages like english, french, german etc)

And good news. It works well in any chromium based browser. Just don't exceed 3750 tweets/day and no one gets banned

Date range not catching personal tweets

the script seems to be un-retweeting just fine but even with old tweets set to true, i'm still able to find my old posts through advanced search. i'm using archive files for this, and i also tried dropping the other files i got in my zip, to no success (depending on the file and date range set, it either catches the same set of (already deleted) retweets every time or nothing at all)
image

i came across another script that uses tweet-headers.js instead, but i'm hesitant to use it since it erases everything and i'd like to keep my last 2 years' worth; do you know if dropping that file into yours will work too?

Uncaught TypeError

VM368:124 Uncaught TypeError: entries is not iterable
at log_tweets (anonymous:123:19)
at anonymous:266:15

Unsure what caused this; acquired all variables as intended and nothing came of it.
Each instance of anonymous was wrapped in <>s. Unsure if this necessary information.

Script does not work in Firefox (125.0.2) or Safari (17.3.1).

In Firefox (125.0.2), the script throws the error:
Uncaught SyntaxError: await is only valid in async functions, async generators and modules

Which can be resolved by wrapping the whole script in an async IIFE:
(async () => { SCRIPT_HERE })();

But doing so results in a different error:
Uncaught (in promise) TypeError: navigator.userAgentData is undefined


In Safari (17.3.1), it throws:
SyntaxError: Unexpected identifier 'sleep'


Just want to throw this out there since, in the prerequisites, you mention that you use Chrome but expect it to work elsewhere.

The script did work as expected for me in Chrome (124.0.6367.119). All of this was done on an M3 MacBook Pro running Sonoma 14.3.1.

doesn't seem to delete replies

everything still works like a charm. thank you. but it doesn't seem to delete replies to tweets or tweet replies. only deletes tweets made to be posted on profiles...

Add unlike option

Would it be possible to add an option to unlike tweets?

Thank you! And thank you for your awesome JS! It helped me a lot!

how to remove media and reply tweets

hello
i started the script and it deleted all my tweets from the tweet tab
but there is still tweets from reply and media tab how do i remove them?
Thank you

Script won't run

followed instructions to a T, keep getting hit with a script error.

"Line: 2
Char: 52
Error: Syntax error
Code: 800A03EA
Source Microsoft JScript compilation error"

I've tried on Brave, Chrome, and Edge and have come up with the same issue. I've also updated Java.

image

Removing RTs?

Is this script meant to remove RTs, or is that a function that is not yet built in OR that has to be toggled somewhere?

Apologies if this is not the correct way to do this. It is exactly my second post on a GitHub thing. Thank you for the script, though. It is beautiful.

How to stop it

I would like to stop the script from running to try and save an old tweet I forgot to include. How can I do this if at all

max likes filter ?

Hello,

The tool looks awesome, but do you plan to add a filter in order to filter tweets with a maximum of X likes ?

Support for Arabic language

Does this script need configuration to support arabic ?

Or do i need to change the value in buildAcceptLanguageString()

I need to delete specific tweets with specific keyword from my account

appretiate the Help

Guidance on Rate Limiting

I'm curious to hear your experience and recommended approach re: rate limiting. I hit the wall at approximately 5 mins.

Some tweets not deleting from archive

Hi!

First I want to thank you for this amazing tool because i was able to delete some 60k tweets thanks to it using the archive method. However, some 7k tweets remain untouchable. Eventually every two weeks or so some of these tweets pop up on my profile, but since it's on mobile I'm forced to delete them by hand. When I download my updated archive, these tweets and medias are showing, but after running the script it just says deletion complete without any tweets being deleted.

Is there a way I can solve this or am I forced to wait until these old tweets pop up and delete them by hand? I want to use this old account as a professional account, and I don't want to start using it if i have to check twice a day whether older tweets are showing up or not right below my newer tweets.

Thank you in advance and have a nice day!

Deletion complete, but tweets remain from 2018 and earlier

Hi there,

Thanks for the really useful tool, but I've hit a problem where it doesn't seem to be able to remove any tweets that were made before the middle of 2018. On the console, it counts down (3) ..., (2) ..., (1)..., DELETION COMPLETE, but even though there are no errors my very old tweets remain.

I'm using the latest version of Chrome (116.0.5845.180).

Let me know what info you need from me to reproduce/debug.

Best,
-Sam

CORS error :(

Hello,

when i try to execute, this is what i get

Access to fetch at 'https://twitter.com/i/api/graphql/[...]_download_video_enabled%22%3Afalse%2C%22responsive_web_enhance_cards_enabled%22%3Afalse%7D' from origin 'https://x.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Thanxs

Retweets and likes

would be nice to add the feature or new tool for delete retweets and likes

Uncaught TypeError: entries is not iterable at log_tweets (<anonymous>:124:19) at <anonymous>:267:15

Hi, I see some other people have gotten this error but haven't seen a solution for it yet, so sorry if I just missed that (or if the solution is something obvious to people with more coding experience than me). I've tried the script in firefox and chrome on all of ubuntu, arch, and windows (updating the IDs &c in each, not just copy/pasting from one browser into another), and gotten the same "entries is not iterable" error. Just above is "VM328:119 undefined" (pointing to "console log(entries)"); "log tweets (:124:19)" is pointing at "for (let item of entries) {", and ":267:15" is pointing at "next = await log_tweets(entries);"

This is the code I'm using with identifying stuff removed; aside from copying in authorisation and IDs I also changed 'unretweet' to true and added items to 'tweets_to_ignore'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.