Posts Tagged mblog

twitter,sina,renren同时

#!/bin/bash
LOGFILE=/path/for/log/file
CURL=/usr/bin/curl
SINACOOKIE=/tmp/sina.cookie
RRCOOKIE=/tmp/renren.cookie
SINAUSER=sina microblog username
SINAPASS=sina microblog password
RRUSER=renren.com username
RRPASS=renren.com password
TWUSER=twitter username
TWPASS=twitter password

STATUS=$1
SWITCH=$2

update_sina()
{
    ${CURL} -d "service=miniblog&entry=miniblog&username=${SINAUSER}&password=${SINAPASS}&url=http://t.sina.com.cn/ajaxlogin.php"  "http://login.sina.com.cn/sso/login.php?client=ssologin.js(v1.3.0)" -e "http://t.sina.com.cn/" -c ${SINACOOKIE} -s >> /dev/null
    RESPONSE=`${CURL} -d "content=${STATUS}&pic=&from=myprofile" "http://t.sina.com.cn/mblog/publish.php" -e "http://t.sina.com.cn/jinuljt" -b ${SINACOOKIE} -s`
	RESULT="t.sina.com.cn "
	if echo ${RESPONSE}|grep -q "data"
	then
		RESULT+="succ"
	else
		RESULT+="fail"
	fi
	echo ${RESULT}|tee -a ${LOGFILE}
}

update_rr()
{
	${CURL} -d "email=${RRUSER}&password=${RRPASS}&origURL=http://www.renren.com/Home.do&domain=renren.com"   "http://passport.renren.com/PLogin.do" -c ${RRCOOKIE} -L -s  >> /dev/null
	RESPONSE=`${CURL} -d "c=${STATUS}&raw=${STATUS}&isAtHome=1" "http://status.renren.com/doing/update.do?" -e "http://status.renren.com/ajaxproxy.htm"  -b ${RRCOOKIE} -L -s`
#echo ${RESPONSE}
	RESULT="renren.com "
	if echo ${RESPONSE}|grep -q "updateStatusId"
	then
		RESULT+="succ"
	else
		RESULT+="fail"
	fi
	echo ${RESULT}|tee -a ${LOGFILE}
}

update_twitter()
{
	RESPONSE=`${CURL} -u "${TWUSER}:${TWPASS}" -d status="${STATUS}" https://twitter.com/statuses/update.xml -s`
#echo ${RESPONSE}
	RESULT="twitter "
	if echo ${RESPONSE}|grep -q "status"
	then
		RESULT+="succ"
	else
		RESULT+="fail"
	fi
	echo ${RESULT}|tee -a ${LOGFILE}
}

echo `date +"%F %H:%M:%S"` >> ${LOGFILE}
echo ${STATUS} >> ${LOGFILE}

if [ -z ${SWITCH} ]
then
   update_twitter
   update_rr
   update_sina
fi

if echo ${SWITCH}|grep -q "r"
then
   update_rr
fi

if echo ${SWITCH}|grep -q "t"
then
	update_twitter
fi

if  echo ${SWITCH}|grep -q "s"
then
	update_sina
fi

echo "" >> ${LOGFILE}

renren对post内容有修改了,需要post中有一个domain用来重定向,否则登录失败。
增加了sina microblog的支持。其实都很简单,就是用wireshark分析了他们的http交互。

以上只要修改用户名和密码就可以了。可以通过“rts”三个字符的出现于否来控制提交到哪几个网站。

No Comments

gtalk robot

最近在使用一python 的gtalk robot
不错,配合上我的twitter,sina,renren同步update的脚本。

我的手机gtalk一直在线。所以只要往我的robot按照我设定的格式发送一条,就能自动update了。

该机器人,可以定义n多自己的命令。不是一般的酷。

,

No Comments

新浪微博使用curl

SINAUSER=username
SINAPASS=password
SINACOOKIE=/path/store/sina/cookie
curl -d "service=miniblog&entry=miniblog&username=${SINAUSER}&password=${SINAPASS}&url=http://t.sina.com.cn/ajaxlogin.php"  "http://login.sina.com.cn/sso/login.php?client=ssologin.js(v1.3.0)" -e "http://t.sina.com.cn/" -c ${SINACOOKIE} -s >> /dev/null
 curl -d "content=${STATUS}&pic=&from=myprofile" "http://t.sina.com.cn/mblog/publish.php" -e "http://t.sina.com.cn/jinuljt" -b ${SINACOOKIE}

,

No Comments

SetTextSize SetPageWidth