从命令行更新twitter

twitter提供了许多接口来使用第三方程序更新用户状态。
然后,我写了个小脚本,利用wget可以方便的做到这点。

内容如下:

#!/bin/sh
##########################################
# Update Twitter Status from Commandline
#
# Author: tiger.lee
# Date: 2009-04-07
# E-mail: i.m.tiger.lee#gmail.com
##########################################

# Usage:
# $ ./twitter MESSAGE
#
# NOTE: if MESSAGE contains space,
# you need to use " to include the message.

# Login Info
# here is your twitter account name
username=”put your username here”
# here is your password
password=”put your password here”

# Do Update Action By wget

# parameters:
# –quite: quiet (no output), no ehco messages.
# –keep-session-cookies: load and save session (non-permanent) cookies.
# –http-user: set http user to USER.
# –http-password: set http password to PASS.
# –post-data: use the POST method; send STRING as the data.
# -O: output file location.

wget –quiet –keep-session-cookies –http-user=$username –http-password=$password –post-data=”status=$1″ http://twitter.com:80/statuses/update.xml -O /dev/null

echo "status updated."

将内容保存为twitter, 然后使用“sh twitter 文本内容”即可更新。

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注