Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Bash oneliner to delete tweets
#!/bin/bash
# Context: https://jamiehall.cc/2020/03/10/delete-all-your-tweets-with-one-line-of-bash/
# https://news.ycombinator.com/item?id=22689746
twurl "/1.1/statuses/user_timeline.json?screen_name=YOUR_TWITTER_HANDLE&count=200&max_id=$(twurl '/1.1/statuses/user_timeline.json?screen_name=YOUR_TWITTER_HANDLE&count=200&include_rts=1' | jq -r '.[9]|.id_str')&include_rts=1" | jq -r '.[]|.id_str' | parallel -j 10 -a - twurl -X POST /1.1/statuses/destroy/{1}.json > /dev/null
@johnelliott

This comment has been minimized.

Copy link

@johnelliott johnelliott commented Mar 26, 2020

thanks, just used this delete all my tweets, I did remove max_id.

@brandongalbraith

This comment has been minimized.

Copy link

@brandongalbraith brandongalbraith commented Mar 26, 2020

@johnelliott I don't have Twitter to test; removing max_id still successfully removed all tweets?

Example:

twurl "/1.1/statuses/user_timeline.json?screen_name=YOUR_TWITTER_HANDLE&count=200&include_rts=1" | jq -c -r '.[] | .id_str' | parallel -j 10 -a - twurl -X POST /1.1/statuses/destroy/{1}.json > /dev/null
@johnelliott

This comment has been minimized.

Copy link

@johnelliott johnelliott commented Mar 26, 2020

@johnelliott I don't have Twitter to test; removing max_id still successfully removed all tweets?

Example:

twurl "/1.1/statuses/user_timeline.json?screen_name=YOUR_TWITTER_HANDLE&count=200&include_rts=1" | jq -c -r '.[] | .id_str' | parallel -j 10 -a - twurl -X POST /1.1/statuses/destroy/{1}.json > /dev/null

Yeah, I did something to the effect of:

twurl "/1.1/statuses/user_timeline.json?screen_name=MYNAME&count=200&include_rts=1" \
  | jq -c -r '.[].id_str' \
  | parallel -j 2 -n 1 twurl -X POST /1.1/statuses/destroy/{1}.json

However I was being pretty casual and re-running a lot of versions thinking I hadn't deleted my tweets when I had and I was seeing others tweets. This was because I was using home_timeline.json and thinking those were mine. I later saw user_timeline.json. That is to say: I can't be 100% sure. It seemed to work :)

@brandongalbraith

This comment has been minimized.

Copy link

@brandongalbraith brandongalbraith commented Mar 26, 2020

👍 👏 Thank you!

@nerdcha

This comment has been minimized.

Copy link
Owner Author

@nerdcha nerdcha commented Mar 26, 2020

This was because I was using home_timeline.json and thinking those were mine.

As Twitter user @Brocklesnitch once remarked, the worst part of Twitter's product design is that you're not allowed to delete other people's tweets…

@nerdcha

This comment has been minimized.

Copy link
Owner Author

@nerdcha nerdcha commented Mar 26, 2020

thanks, just used this delete all my tweets, I did remove max_id.

Sweet 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment