-
-
Save grega/38c412bf15d7daa44ee66880f68be4e7 to your computer and use it in GitHub Desktop.
Disable RTs from all the people you follow on Twitter.
This file contains 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 "rubygems" | |
require "twitter" | |
# get these from apps.twitter.com | |
CONSUMER_KEY = "foo" | |
CONSUMER_SECRET = "bar" | |
OAUTH_TOKEN = "blee" | |
OAUTH_TOKEN_SECRET = "baz" | |
TWITTER_USER = "your_username" # needs to be the one associated with keys above | |
client = Twitter::REST::Client.new do |config| | |
config.consumer_key = CONSUMER_KEY | |
config.consumer_secret = CONSUMER_SECRET | |
config.access_token = OAUTH_TOKEN | |
config.access_token_secret = OAUTH_TOKEN_SECRET | |
end | |
following_ids = client.friend_ids(TWITTER_USER).to_a | |
puts "🙉" | |
following_ids.each do |id| | |
begin | |
puts "Disabling RTs from your pal #{client.user(id).screen_name}" | |
client.friendship_update(client.user(id), {:retweets => false}) | |
rescue Twitter::Error::TooManyRequests => error | |
puts "Got an error, probably rate-limiting... waiting #{error.rate_limit.reset_in} seconds to try again" | |
sleep(error.rate_limit.reset_in) | |
retry | |
end | |
end | |
puts "Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment