Created
May 20, 2018 19:28
-
-
Save mattly/34a0eed772ca10435b01ef95bb504aba to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env ruby | |
require "rubygems" | |
require "twitter" | |
require './mattly' | |
TWITTER_USER = Mattly.user | |
client = Mattly.client | |
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!" |
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
module Mattly | |
# things you must configure | |
def self.user | |
"mattly" | |
end | |
# get these from dev.twitter.com | |
CONSUMER_KEY = "---YOUR KEY GOES HERE---" | |
CONSUMER_SECRET = "---YOUR SECRET GOES HERE---" | |
OAUTH_TOKEN = "---YOUR KEY GOES HERE---" | |
OAUTH_TOKEN_SECRET = "---YOUR SECRET GOES HERE---" | |
def self.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 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment