Skip to content

Instantly share code, notes, and snippets.

@ToQoz
Forked from dnpp73/favter.rb
Created August 14, 2011 11:52
Show Gist options
  • Save ToQoz/1144823 to your computer and use it in GitHub Desktop.
Save ToQoz/1144823 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