Update Status Twitter via Shell Script

Posted on 9 February 2010 by

Twitter Status UpdateUntuk mengupdate status twitter lewat shell script sebenarnya kita hanya menggunakan HTTP request. Perintah yang digunakan adalah POST(bukan metode HTTP) atau nama lainnya lwp-request sebuah perl script yang hampir semua distribusi pasti ada. OK langusng aja kita praktikan bagaimana caranya.

Langkah-langkah

  1. Buka text editor favorite kamu.
  2. Copy dan paste code dibawah ini.
    #!/bin/bash
    #
    TUNAME="lesstalkme"
    TUPASS=""
    TSTATUS=""
    TURL="http://twitter.com/statuses/update.xml"
    TDATA="source=LTME&status="
    
    # print some fancy header :)
    echo "-----------------------------------------"
    echo " Twitter Status Updater"
    echo " http://www.less-talk-more-example.info/"
    echo "------------------------------------------"
    
    echo -n "Twitter Password: "
    read -ers TUPASS
    echo -e "\nEnter Twitter Status:"
    read TSTATUS
    
    # replace some characters ( I"m too lazy to replace all the characters :))
    TSTATUS=`echo $TSTATUS | sed "s/ / /g"` # space => 
    TSTATUS=`echo $TSTATUS | sed "s/@/@/g"` # @ => @
    TSTATUS=`echo $TSTATUS | sed "s/\////g"` # / => /
    TSTATUS=`echo $TSTATUS | sed "s/:/:/g"` # : => ;
    TSTATUS=`echo $TSTATUS | sed "s/#/#/g"` # # => #
    
    # now POST the data
    echo ""
    echo -n "Updating status..."
    echo "${TDATA}${TSTATUS}" | POST -C casino  $TUNAME:$TUPASS $TURL | grep $TUNAME > /dev/null
    # check status
    # ------------
    # successfull request always return XML format that containts our username
    # so we grep that to check the status
    if [ $? -eq 0 ]; then
     echo "DONE."
    else
     echo "ERROR."
    fi
    
  3. Ganti TUNAME dengan username kamu sendiri.
  4. Simpan ke satu directory misal /tmp (karena hanya tes).
  5. Beri nama twitter.sh
  6. Buka terminal System » Application » Terminal
  7. Masuk ke /tmp direktori dan berikan permission execute pada file tersebut.
  8. $ cd /tmp
    $ chmod x twitter.sh
  9. Eksekusi file tersebut, kamu akan ditanya password dan status kamu.
    $ ./twitter.sh
  10. Setelah itu maka status twitter kamu telah terupdate :).
    Twitter Status

Download the Code

twitter.sh.zip via ziddu.com.
Size: 0.69kb
MD5 Checksum: f9d38c632430a617331cc4f8d298fcf1

Video

Untuk melihat video screencast dari tutorial ini klik http://lug.stikom.edu/2010/02/screencast-update-twitter-status-via-shell-script/

Sumber:
http://www.less-talk-more-example.info/2010/02/update-twitter-status-via-shell-script.html

Related Post

49 Comments

http://bernco.gov/

14 October 2014

What’s Happening i’m new to this, I stumbled upon this
I have found It absolutely heslpful and it has aided me out loads.
I hope to give a contribution & assist other users like its aided me.
Good job.


SEO Newquay

10 October 2014

Appreciating the time and energy you pput into your blog and detailed information you provide.
It’s nice to come across a blog every once in a while that isn’t the sae unwanted rehashed information. Excellent read!
I’ve bookmarkwd your site and I’m acding your RSS fewds to
my Google account.


Post a Comment

Your email is never shared.