Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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