Created
April 26, 2012 16:54
-
-
Save hrysd/2500948 to your computer and use it in GitHub Desktop.
RubyでFavoriteしましょう!!
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
#coding: utf-8 | |
require 'twitter' | |
Twitter.configure do |config| | |
config.consumer_key = 'CONSUMER_KEY' | |
config.consumer_secret = 'CONSUMER_SECRET' | |
config.oauth_token = 'OAUTH_TOKEN' | |
config.oauth_token_secret = 'OAUTH_TOKEN_SECRET' | |
end | |
client = Twitter::Client.new | |
puts "誰に?" | |
who = gets.chomp | |
puts "どれくらい?" | |
number = gets.chomp | |
tweets = client.user_timeline(who, count: number) | |
tweets.each_with_index do |tweet, i| | |
puts "#{i}:#{tweet.text}" | |
begin | |
client.favorite_create(tweet.id) | |
puts 'fav' | |
rescue => error | |
puts error.message, "\n" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment