如何同步你的腾讯微博和百度说吧,并附上同步客户端 | 2010年09月26日
对于这两款没有提供API的微博,要同步,可以用模拟你登录并发送微博的方式,由于本人时间有限,且本客户端只供自己使用,所以并没做进一步的界面和程序优化,有兴趣的可以下载使用,如果不相信本人写的程序,可以自行编译源代码为二进制可运行文件,或者下载perl解释器进行解释。
==============================================
这里是下载链接(为二进制文件):微博同步客户端
有部分网友要求添加微博通同步,已经添加,如要使用需要有微博通帐号,新版本同步客户端可在这下载:
使用之前,只须打开config文件,按顺序填写用户密码即可
windows客户端:

web客户端:

#!perl -w
use strict;
use Tk;
use Encode;
use LWP;
use HTTP::Cookies;
use HTTP::Request::Common;
use URI;
use Digest::MD5 qw(md5 md5_hex);
my $mw; # 主窗口
$mw = MainWindow->new;
my $f; # 框架,用于顶部操作项目的步局
$f = $mw->Frame->pack(-side => 'top', -fill => 'x');
my $f2; # 框架,用于顶部操作项目的步局
$f2 = $mw->Frame->pack(-side => 'bottom', -fill => 'x');
my $info = decode("utf8", "导入状态");
$f2->Label(-textvariable => $info, -background => 'green')
->pack(-side => 'left', -fill => 'x');
# 要发送的信息
my $text;
$text = $f->Text(-width => 60, -height => 10)->pack(-side => 'top', -fill => 'x');;
my $goBtn;
$goBtn = $f2->Button(-text => decode("utf8", "发送"), -command=>&begin_send)
->pack(-side => 'right');
MainLoop;
sub begin_send {
open CONFIG, "<config";
my $baiduName = <CONFIG>;
chomp($baiduName);
$baiduName =~ s/(s*)$//;
my $baiduPass = <CONFIG>;
chomp($baiduPass);
$baiduPass =~ s/(s*)$//;
my $qqName = <CONFIG>;
chomp($qqName);
$qqName =~ s/(s*)$//;
my $qqPass = <CONFIG>;
chomp($qqPass);
$qqPass =~ s/(s*)$//;
my $msg = $text->get("1.0", "end");
my $ua = LWP::UserAgent->new;
$ua->cookie_jar(HTTP::Cookies->new(file=>'./lwp-cookies-baidu', autosave=>1));
&baiduLogin($ua, $baiduName, $baiduPass);
#print $baiduName, $baiduPass;
&sendBaiduMsg($ua, $msg);
$ua->cookie_jar(HTTP::Cookies->new(file=>'./lwp-cookies-qq', autosave=>1));
&qqLogin($ua, $qqName, $qqPass);
&qqSend($ua, $msg);
$text->delete("1.0", "end");
}
sub baiduLogin {
my $uaRef = shift;
my $name = shift;
my $pass = shift;
my $request = POST('http://t.baidu.com/userlogin',
Content => [ 'UserLoginForm[username]' => $name,
'UserLoginForm[password]' => $pass
],
Referer => 'http://t.baidu.com'
);
my $response = $$uaRef->request($request);
}
sub sendBaiduMsg {
my $uaRef = shift;
my $msg = shift;
my $rand = int(rand(999)+1000);
my $request = POST('http://t.baidu.com/message/post?' . $rand,
Content => [ m_content => $msg ],
Referer => 'http://t.baidu.com'
);
my $response = $$uaRef->request($request);
}
sub qqLogin {
my $uaRef = shift;
my $name = shift;
my $pass = shift;
my $verifyURL = 'http://ptlogin2.qq.com/check?uin=@'. $name . '&appid=46000101';
my $request = HTTP::Request->new(GET => $verifyURL);
my $response = $$uaRef->request($request);
my $content = $response->content;
my $verifyCode = substr($content, 18, 4);
my $pwd = uc md5_hex(md5(md5($pass)));
my $loginUrl = 'http://ptlogin2.qq.com/login?' . 'u=@' .
$name .
'&p='.md5_hex($pwd.$verifyCode).
'&verifycode='.
$verifyCode.
'&aid=46000101&u1=http\\\\%3A\\\\%2F\\\\%2Ft.qq.com&h=1&from_ui=1&fp=loginerroralert';
$request = HTTP::Request->new(GET => $loginUrl);
$response = $$uaRef->request($request);
}
sub qqSend {
my $uaRef = shift;
my $msg = shift;
my $request = POST('http://t.qq.com/publish.php',
Content => [ content => $msg
],
Referer => 'http://t.qq.com'
);
my $response = $$uaRef->request($request);
}
该日记提交于10:07:07





跳到评论框添加评论
对“[转]建议腾讯收购金山软件”的评论: