Skip to content

Instantly share code, notes, and snippets.

@kkosuge
Created July 23, 2011 09:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save kkosuge/1101243 to your computer and use it in GitHub Desktop.
Save kkosuge/1101243 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 "爆撃数(MAX 3200): "
count = gets.chomp.to_i
@tweets = []
(count / 200 + 1).times do |i|
c = count-i*200 > 200 ? 200 : count-i*200
begin
@tweets << client.user_timeline(target, count: c , page: i+1)
rescue => e
puts e
next
end
end
@tweets.each_with_index do |tweets,i|
tweets.each_with_index do |tweet,index|
puts "#{i*200 + index + 1}: #{tweet.text}"
Thread.new do
begin
client.favorite_create(tweet.id)
puts "done!"
rescue => e
puts e
end
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