Here's a Twitter Follower Script

Joined
Mar 14, 2013
Messages
8
Reaction score
0
Hi all,

I just wrote this and thought it may be useful for some. It searches twitter and follows users who mention a given keyword. I'm not going to help you use it as it's pretty self explanatory. Enjoy.

Code:
#!/usr/bin/env rubyrequire 'twitter'
class Twibot
    def initialize(arguments, stdin)        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 TOKEN SECRET}"        end    end
    def follow(keyword)      Twitter.search(keyword, :rpp => 100, :result_type => "recent").results.map do |status|         Twitter.follow("#{status.from_user}")         puts "Followed #{status.from_user}"
         rnd = Random.new(Time.now.to_i % 10)         result = rnd.rand(60..70)                  sleep(result)      end
      self.follow(keyword)    end
    def run        self.follow("{ENTER KEYWORD TO SEARCH FOR}")    end      end
app = Twibot.new(ARGV, STDIN)app.run
 
Last edited:
Sorry for the awful formatting, this forum killed all the whitespace in the code tags and won't let me post a link to a formatted version.
 
Back
Top