Skip to content

Instantly share code, notes, and snippets.

@ppira07
Created March 2, 2014 13:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ppira07/9306824 to your computer and use it in GitHub Desktop.
Save ppira07/9306824 to your computer and use it in GitHub Desktop.
require "twitter"
class Favoritter
def initialize(source, count)
@source = source
@count = count.to_i
@client = Twitter::REST::Client.new do |config|
config.consumer_key = ""
config.consumer_secret = ""
config.access_token = ""
config.access_token_secret = ""
end
end
def fav!
tweets = []
catch :break do
(1..16).each do |page|
@client.user_timeline(@source, count: 200, include_rts: false, page: page).each do |tweet|
unless tweet.favorited? then
tweets << tweet
puts tweet.text
throw :break if tweets.size > @count
end
end
end
end
@client.favorite(tweets)
end
end
Favoritter.new(ARGV[0], ARGV[1] || 20).fav!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment