Code Monkey home page Code Monkey logo

twitterdelete's Introduction

TwitterDelete ๐Ÿ’€ (archived)

TwitterDelete was a small application to delete your old, unpopular tweets and likes.

Starting February 9, we will no longer support free access to the Twitter API, both v2 and v1.1. A paid basic tier will be available instead

https://twitter.com/TwitterDev/status/1621026986784337922

I have zero interest maintaining anything using the Twitter API given this.

If you're still using Twitter: get yourself to Mastodon which:

  • has TwitterDelete behaviour already built-in as a feature
  • is nice like Twitter was 10 years ago

Come on, follow me on Mastodon, it's lovely over here.

Features

  • Delete, unlike and unretweet tweets
  • Keep tweets based on age and tweaks based on retweet or favourite count
  • Delete tweets no longer exposed by Twitter API from a downloaded Twitter archive file

Usage

To setup locally run:

git clone https://github.com/mikemcquaid/TwitterDelete
cd TwitterDelete
bundle install

Get the Twitter API variables from https://apps.twitter.com and add the following variables to a .env file in the TwitterDelete folder:

TWITTER_CONSUMER_KEY=...
TWITTER_CONSUMER_SECRET=...
TWITTER_ACCESS_TOKEN=...
TWITTER_ACCESS_TOKEN_SECRET=...

Now run TwitterDelete:

./twitter_delete.rb --user TwitterUsername

If you fork this PR you can also used the GitHub Actions scheduled workflow combined with secrets on your fork to run this automatically.

Status

Works for deleting relevant tweet and likes. I delete my old tweets and am not actively working on improving this but I will accept pull requests.

Contact

Mike McQuaid

License

TwitterDelete is licensed under the AGPLv3 License. The full license text is available in LICENSE.txt.

twitterdelete's People

Contributors

ashleyconnor avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar mikemcquaid avatar seantallen 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  avatar  avatar  avatar  avatar

twitterdelete's Issues

Deprecated gem warning

Ever time I run this (in a macOS terminal) I get the following warning:

[DEPRECATION] This gem has been renamed to optimist and will no longer be supported. Please switch to optimist as soon as possible.

I assume something simply needs to be renamed, but it doesn't actually say which gem got renamed... haha.

Support tweet.js

Twitter has started sending a fuller archive, with tweets in a tweet.js file instead of tweets.csv. It's a plain JS object so probably pretty simple to convert to OpenStruct or even regex it.

Incorrect tweet count

When processing an archive file, TwitterDelete comes up with an incorrect tweet count. I think what's happening is tweets from the archive and from the API are being double-counted. The number being reported is approximately 3,000 more than my archive even has.

I'll investigate more, but wanted to file the issue so it wouldn't be lost.

Install fails

Generates error after bundle install.

"An error occurred while installing unf_ext (0.0.7.4), and Bundler
cannot continue.
Make sure that gem install unf_ext -v '0.0.7.4' succeeds before bundling."

Request: Save specific tweet IDs

Making a cheeky request for a feature that allows people to not delete specific tweet IDs. Tried coding something myself, but had little progress so far. My Ruby, as we both know, still sucks ๐Ÿ˜ข. I'll keep reading the Twitter gem documentation and see if I can come up with something that works with the script though.

Old tweets causing error

I'm getting odd errors, presumably from old Tweets the API isn't returning.

/usr/local/lib/ruby/gems/2.3.0/gems/twitter-5.14.0/lib/twitter/rest/response/raise_error.rb:15:in `on_complete': No status found with that ID. (Twitter::Error::NotFound)
        from /usr/local/lib/ruby/gems/2.3.0/gems/faraday-0.9.1/lib/faraday/response.rb:9:in `block in call'
        from /usr/local/lib/ruby/gems/2.3.0/gems/faraday-0.9.1/lib/faraday/response.rb:57:in `on_complete'
        from /usr/local/lib/ruby/gems/2.3.0/gems/faraday-0.9.1/lib/faraday/response.rb:8:in `call'
        from /usr/local/lib/ruby/gems/2.3.0/gems/faraday-0.9.1/lib/faraday/request/url_encoded.rb:15:in `call'
        from /usr/local/lib/ruby/gems/2.3.0/gems/faraday-0.9.1/lib/faraday/request/multipart.rb:14:in `call'
        from /usr/local/lib/ruby/gems/2.3.0/gems/twitter-5.14.0/lib/twitter/rest/request/multipart_with_file.rb:17:in `call'
        from /usr/local/lib/ruby/gems/2.3.0/gems/faraday-0.9.1/lib/faraday/rack_builder.rb:139:in `build_response'
        from /usr/local/lib/ruby/gems/2.3.0/gems/faraday-0.9.1/lib/faraday/connection.rb:377:in `run_request'
        from /usr/local/lib/ruby/gems/2.3.0/gems/faraday-0.9.1/lib/faraday/connection.rb:177:in `post'
        from /usr/local/lib/ruby/gems/2.3.0/gems/twitter-5.14.0/lib/twitter/rest/request.rb:33:in `perform'
        from /usr/local/lib/ruby/gems/2.3.0/gems/twitter-5.14.0/lib/twitter/rest/utils.rb:51:in `perform_request'
        from /usr/local/lib/ruby/gems/2.3.0/gems/twitter-5.14.0/lib/twitter/rest/utils.rb:73:in `perform_request_with_object'
        from /usr/local/lib/ruby/gems/2.3.0/gems/twitter-5.14.0/lib/twitter/rest/utils.rb:151:in `block in parallel_objects_from_response'
        from /usr/local/lib/ruby/gems/2.3.0/gems/twitter-5.14.0/lib/twitter/utils.rb:39:in `block (2 levels) in pmap'

As a fix (and as a feature I like) I also added a parameter to not delete my oldest tweets (as I like having the very old ones there just to brag my account is in the first handful of ones created)
https://github.com/bobbysteel/TwitterDelete/blob/master/twitter_delete.rb

.env file not working

Hi there, thanks for making this open source and sorry this is probably a dumb question.

I put all my api keys into a file called 'secrets.env' in the twitterdelete folder but when i'm running ./twitter_delete.rb --user irl i get environment variable must be set

Should my keys be in plaintext or have quotes around them like normal ruby strings? i tried both and neither worked. Some help with implementation would be appreciated. Thanks so much!

Dies with a vast number of Tweets.

Had this happen every time so far. I have a stupidly large number of tweets I want to be rid of, so that's perhaps the cause of the issue. Haven't tried other scripts that use the csv file to delete long-since gone-from-the-maximum-visible-limit tweets, so this might not be entirely the fault of the script. Tried with the system Ruby without luck as well.

I was using another tool before yours', but it couldn't delete past the visible-limit, and it wasn't as up-to-date on the API calls as this one, so I switched.

bundle exec ./twitter_delete.rb --user Dom_T4 --csv tweets.csv --force
...

==> Deleting 57439 tweets
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/twitter-5.14.0/lib/twitter/rest/request.rb:37:in `rescue in perform': execution expired (Twitter::Error)
    from /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/twitter-5.14.0/lib/twitter/rest/request.rb:32:in `perform'
    from /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/twitter-5.14.0/lib/twitter/rest/utils.rb:51:in `perform_request'
    from /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/twitter-5.14.0/lib/twitter/rest/utils.rb:73:in `perform_request_with_object'
    from /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/twitter-5.14.0/lib/twitter/rest/utils.rb:65:in `perform_post_with_object'
    from /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/twitter-5.14.0/lib/twitter/rest/tweets.rb:100:in `block in destroy_status'
    from /usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/twitter-5.14.0/lib/twitter/utils.rb:39:in `block (2 levels) in pmap'

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.