#!/usr/bin/ruby
=begin
Tweeby, simple script to update twitter status
Copyright (C) 2009 [email protected]
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
=end
#
# .__ .___ ___.
# |__| __| _/ _______ __ _\_ |__ ___.__.
# | |/ __ | ______ \_ __ \ | \ __ < | |
# | / /_/ | /_____/ | | \/ | / \_\ \___ |
# |__\____ | |__| |____/|___ / ____|
# \/ \/\/
# [email protected]
#
# http://snippet.c0de.me
# aji_okay[at]yahoo[dot]co[dot]id
require 'optparse'
require 'net/http'
class Tweeby
def initialize
puts '-------------------------------------------------------'
puts '[+] Tweeby - Ruby script to update twitter status'
puts '[+] Tweeby.rb - http://snippet.c0de.me'
puts "-------------------------------------------------------\n\n"
end
def parseOption
begin
options = {}
opts = OptionParser.new
opts.banner = "Usage: ./tweeby.rb -u your_username -p your_password
-s your_status\nExample: ./tweeby.rb -u myuser -p mypassword -s 'this is my
status'"
opts.on('-u your_username', '--user your_username', 'your_username
= Your Twitter username') do |u|
@username = u
end
opts.on('-p your_password', '--password your_password',
'your_password = Your Twitter password') do |p|
@passwd = p
end
opts.on('-s your_status', '--status your_status', 'your_status =
Your Twitter status message') do |s|
@status = s
end
opts.on('-v', '--verbose', 'Run verbosely') do |v|
@verbose = v
end
opts.parse!
if (!(@username and @passwd and @status))
puts opts
exit(1)
end
rescue OptionParser::ParseError
puts opts
exit(1)
end
end
def sendTweet
begin
puts '[+] Starting Tweeby...'
tweet = Net::HTTP.post_form(
URI.parse("http://#...@username}:#...@passwd}@twitter.com/statuses/update.xml"),
{"status"=>"#...@status}"})
if @verbose
puts tweet.body
else
puts '[+] Your status has been updated'
end
puts '[+] Done...'
rescue Exception
puts '[-] Error while tweeting, check your username, password, and
internet connection'
end
end
end
# main
twitter = Tweeby.new
twitter.parseOption
twitter.sendTweet
________________________________
warm regards,
Kunto Aji K
blog: http://akulahaji.blogspot.com http://kuntoaji.blogspot.com
Mencari semua teman di Yahoo! Messenger? Undang teman dari Hotmail, Gmail
ke Yahoo! Messenger dengan mudah sekarang! http://id.messenger.yahoo.com/invite/
[Non-text portions of this message have been removed]