Skip to content

Instantly share code, notes, and snippets.

@d-sea
Last active October 3, 2015 04:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d-sea/b03f4fef85a06267faca to your computer and use it in GitHub Desktop.
Save d-sea/b03f4fef85a06267faca to your computer and use it in GitHub Desktop.
require 'twitter'
# login
client = Twitter::REST::Client.new do |config|
config.consumer_key = ENV['CONSUMER_KEY']
config.consumer_secret = ENV['CONSUMER_SECRET']
config.access_token = ENV['ACCESS_TOKEN']
config.access_token_secret = ENV['ACCESS_TOKEN_SECRET']
end
keyword = "hirofukami.com"
results = client.search(keyword, :result_type => "recent")
results.each do |tweet|
if tweet.user.screen_name != "d_sea"
text = tweet.user.screen_name + ": " + tweet.text
begin
puts text
client.retweet(tweet.id)
rescue Exception => e
puts e.message
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment