Posts Tagged twitter

同时更新renren与twitter

同时更新 renren与twitter状态的bash脚本。

对于renren网,使用curl模拟登录与提交。
之与twiiter则使用curl直接调用其api提交。

#!/bin/bash
CURL=/usr/bin/curl
COOKIE=/tmp/renren.cookie
STATUS=$1
RRUSER=renren username
RRPASS=renren password
TWUSER=twitter username
TWPASS=twitter password
${CURL} -d "email=${RRUSER}&password=${RRPASS}" "http://passport.renren.com/PLogin.do"   -c ${COOKIE} -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 ${COOKIE} -L -s`
#echo ${RESPONSE}
echo "Update renren.com"
if echo ${RESPONSE}|grep -q "updateStatusId"
then
echo "successful"
else
echo "fail"
fi

RESPONSE=`${CURL} -u "${TWUSER}:${TWPASS}" -d status="${STATUS}" https://twitter.com/statuses/update.xml -s`
#echo ${RESPONSE}
echo "Update twitter.com"
if echo ${RESPONSE}|grep -q "status"
then
echo "successful"
else
echo "fail"
fi

, ,

2 Comments

SetTextSize SetPageWidth