AutoIt是个简单易用的Windows环境脚本语言。今天写了个用AutoIt+cURL+Proxy组合起来批量发推的脚本(一定要注册个新的帐号测试,今天我刷屏20条,被tinyfool鄙视了……):
$tusername = "type-your-username-here" $tpassword = "type-your-password-here" $proxy = "127.0.0.1:9666" $textfile = "textfilename-containing-one-tweets-per-line" $inteval = 60000 $file = FileOpen($textfile, 128) While 1 $line = FileReadLine($file) If StringLen($line)>140 Then $line=StringLeft($line, 140) _TwitterUpdateStatus($line) ConsoleWrite($line & @CRLF) Sleep($inteval) WEnd MsgBox(0, "", "finished!") Func _TwitterUpdateStatus($message) Run('curl -x ' & $proxy & ' -u ' & $tusername & ':' & $tpassword & ' -d "status=' & _UnicodeURLEncode($message) & '" http://twitter.com/statuses/update.xml', "", @SW_HIDE) EndFunc Func _UnicodeURLEncode($UnicodeURL) $UnicodeBinary = StringToBinary ($UnicodeURL, 4) $UnicodeBinary2 = StringReplace($UnicodeBinary, '0x', '', 1) $UnicodeBinaryLength = StringLen($UnicodeBinary2) Local $EncodedString For $i = 1 To $UnicodeBinaryLength Step 2 $UnicodeBinaryChar = StringMid($UnicodeBinary2, $i, 2) If StringInStr("$-_.+!*'(),;/?:@=&abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", BinaryToString ('0x' & $UnicodeBinaryChar, 4)) Then $EncodedString &= BinaryToString ('0x' & $UnicodeBinaryChar) Else $EncodedString &= '%' & $UnicodeBinaryChar EndIf Next Return $EncodedString EndFunc

{ 11 comments… read them below or add one }
支持下 ,沙发
这个语法 完全等于 php+asp 混合
还有curl
有点意思哈,呵呵 谢谢分享
看不懂,能否加点注释?
不错!
我接收到几条老外发的,带了@指向
就是因为我的用户名太短了~
不知道笑来老师现在用什么方法上twitter呢?
follow me on twitter: yaoeryi
笑来兄
不是吧,点你的下载
居然有特洛伊木马!!!
to pc, 晕。我安装的是360杀毒,查过。唉,那你就不要用了。反正代码都在那里。如果是检测出u96.exe有毒,那可能是误报。
follow me on twitter: xiaolai
1、呵呵,360杀毒。建议笑来先生试试这个http://www.avast.com/
2、这是捷克(布拉格)的一家杀毒软件公司的产品。有家用免费版。
下载地址:http://www.avast.com/cns/download-avast-home.html
所获奖项:http://www.avast.com/cns/awards.html
请点这个,“由于连接关系,中国地区用户直接从我们网站下载所需时间可能较长. ”
不要单击大大的“马上下载”(从IT168上面下载)的那个图标。我试过,那个是个试用版。
3、下载后,只要在下载地址页面的注册那里注册一下。就可以免费使用一年。一年后同样步骤,即可使用第二年。
所有过程,均无需付费。唯一需要注意的就是,“家用”。
过去的两三年里我一直在用avast。只是最近想换换360试试看。
follow me on twitter: xiaolai
传说360后台窃取用户信息
这事老师知道吗?