-
-
Save jaehess/3880162 to your computer and use it in GitHub Desktop.
Delete all your tweets from Twitter with Ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'twitter' | |
require 'peach' | |
USERNAME = '' # put your twitter username here | |
Twitter.configure do |config| | |
config.consumer_key = YOUR_CONSUMER_KEY | |
config.consumer_secret = YOUR_CONSUMER_SECRET | |
config.oauth_token = YOUR_OAUTH_TOKEN | |
config.oauth_token_secret = YOUR_OAUTH_SECRET | |
end | |
until Twitter.rate_limit_status.remaining_hits == 0 do | |
for page in 1..20 | |
statuses = Twitter.user_timeline(USERNAME, {:count => 200, :include_entities => false, :trim_user => true, :include_rts => false, :page => page}) | |
puts "Rate limit=#{Twitter.rate_limit_status.remaining_hits}" | |
puts "page=#{page} statuses=#{statuses.length}" | |
statuses.peach do |s| | |
if Twitter.status_destroy(s.attrs['id']) | |
puts "Status #{s.attrs['id']} deleted." | |
end | |
end | |
end | |
end | |
puts "All Tweets deleted or rate limit hit (reset time=#{Twitter.rate_limit_status.reset_time})." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment