Saya juga membuat script kecil pake ruby + curl. Bisa dilihat
di http://wewchat.com/posts/15
atau brkt copy paste nyarequire 'rubygems'
require 'highline/import'
username = ask("Username: "){|q| q.echo = true}
password = ask("Password: "){|q| q.echo = "*"}
`curl -X POST -u #{username}:#{password} -d "status=#{ARGV[0]}"
http://twitter.com/statuses/update.xml`
Untuk menggunakan script tersebut, panggil script tsb dengan ruby
ruby twit.rb "now, I am eating..."
sugiarto
http://ugifractal.wordpress.com
--- On Mon, 8/10/09, hendra kusuma <[email protected]> wrote:
From: hendra kusuma <[email protected]>
Subject: Re: [id-ruby] [share] Tweeby, simple ruby script utk update twitter
status
To: [email protected]
Date: Monday, August 10, 2009, 1:36 AM
On Sun, Aug 9, 2009 at 9:24 PM, kunto aji <aji_o...@yahoo.
co.id> wrote:
>
>
> #!/usr/bin/ruby
> =begin
> Tweeby, simple script to update twitter status
> Copyright (C) 2009 aji_o...@yahoo. co.id <aji_okay%40yahoo. co.id>
>
> 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
> #
> # .__ .___ ___.
> # |__| __| _/ _______ __ _\_ |__ ___.__.
> # | |/ __ | ______ \_ __ \ | \ __ < | |
> # | / /_/ | /_____/ | | \/ | / \_\ \___ |
> # |__\____ | |__| |____/|___ / ____|
> # \/ \/\/
> # id-r...@yahoogroups .com <id-ruby%40yahoogro ups.com>
> #
> # 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<passwd%7D%40twitte r.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
>
> __
>
Cool
--
Suka linux?
Kunjungi blog saya http://penguinroad. blogspot. com
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]