Created
March 2, 2014 13:49
-
-
Save ppira07/9306824 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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