Skip to content

Instantly share code, notes, and snippets.

@hitode909
Forked from yoko/twitter_air_post.rb
Created July 10, 2010 16:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hitode909/470855 to your computer and use it in GitHub Desktop.
Save hitode909/470855 to your computer and use it in GitHub Desktop.
#!ruby
require 'rubygems'
require 'twitter'
require 'pit'
def enjoy(&block)
begin
block.call
rescue => e
puts e.message
end
end
exit unless ARGV[0]
config = Pit.get('twitter', :require => {
'username' => 'username',
'password' => 'password',
});
httpauth = Twitter::HTTPAuth.new(config['username'], config['password'])
client = Twitter::Base.new(httpauth)
30.times {
begin
puts 'post'
data = client.update(ARGV[0])
puts data.id
rescue => e
puts e.message
enjoy {
client.user_timeline('hitode909').each{ |status|
if status.text == ARGV[0]
puts 'destroy old status'
client.status_destroy(status.id)
end
}
}
next
end
enjoy {
puts 'destroy'
client.status_destroy(data.id)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment