Skip to content

Instantly share code, notes, and snippets.

@alea12
Last active December 15, 2015 13:58
Show Gist options
  • Save alea12/5270561 to your computer and use it in GitHub Desktop.
Save alea12/5270561 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'twitter'
Twitter.configure do |config|
config.consumer_key = ''
config.consumer_secret = ''
config.oauth_token = ''
config.oauth_token_secret = ''
end
print "target: "
target = STDIN.gets.chomp
print "count: "
count = STDIN.gets.chomp.to_i
options = {:count=>count , :exclude_replies=>true, :include_rts=>false}
i = 0
Twitter.user_timeline(target, options).each do |post|
begin
Twitter.favorite(post.attrs[:id])
print "*"
i += 1
rescue => e
puts e
end
end
puts "\nfavorited " + i.to_s + " posts."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment