Skip to content

Instantly share code, notes, and snippets.

@dnpp73
Forked from kkosuge/favter.rb
Created August 5, 2011 09:07
Show Gist options
  • Save dnpp73/1127171 to your computer and use it in GitHub Desktop.
Save dnpp73/1127171 to your computer and use it in GitHub Desktop.
favorit爆撃を与えてターゲットのデスクトップをGrowlで埋めるなどします
#coding: utf-8
require 'twitter'
Twitter.configure do |config|
config.consumer_key = YOUR_CONSUMER_KEY
config.consumer_secret = YOUR_CONSUMER_SECRET
config.oauth_token = YOUR_OAUTH_TOKEN
config.oauth_token_secret = YOUR_OAUTH_TOKEN_SECRET
end
client = Twitter::Client.new
print "screen_name: "
target = gets.chomp
print "爆撃数(MAX200): "
count = gets.chomp
tweets = client.user_timeline(target,:count=>count)
tweets.each_with_index do |tweet,index|
puts "#{index + 1}: #{tweet.text}"
Thread.new do
begin
client.favorite_create(tweet.id)
puts "done!"
rescue => e
puts e
end
end
end
Thread::list.each {|t| t.join if t != Thread::current}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment