标题: [原创代码] Perl自动回帖赚积分啊 [打印本页]
作者: sxw 时间: 2013-5-6 17:57 标题: Perl自动回帖赚积分啊
- 自动回复ZET u880论坛最新发表的帖子,赚金币用的。我是先登录进去论坛再用的,不会写自动登录的部分。。 呵呵,没技术含量,玩玩就行了。
-
- use strict;
- use warnings;
- use HTML::TokeParser;
- use LWP::Simple;
- use Win32::IEAutomation;
- use Win32::GuiTest qw(:ALL);
- use Win32::Clipboard;
- our $ie = Win32::IEAutomation->new( visible => 1, maximize => 1); #申明一个全局变量,避免打开多个IE窗口
- $|=1;
- my $CLIP;
- tie $CLIP,'Win32::Clipboard';
- open (FH,"<","baidu.txt") or die; #baidu.txt一定要另存为ANSI格式,否则乱码
- my @text=<FH>;
- my ($i,$n)=(0,0);
- my %hash;
- for ($i=0;$i<=1;$i+=112){
- my $filename=get("http://bbs.hiapk.com/forum.php?mod=forumdisplay&fid=520&filter=author&orderby=dateline&page=$i");
- parse_fresh_stream(HTML::TokeParser->new(\$filename) || die($!), 'http://bbs.hiapk.com');
-
- #print $filename,"\n";
-
- sub parse_fresh_stream {
- use URI;
- my($stream, $base_url) = @_;
- while(my $a_tag = $stream->get_tag('a')) {
- my $url = URI->new_abs( ($a_tag->[1]{'href'} || next), $base_url);
- next unless $url->scheme eq 'http';
- next unless $url->host =~ m/bbs\.hiapk\.com/;
- next unless $url =~ /http:.*?forum.php\?mod=viewthread.*?dateline$/;
- $hash{$url}=1;
- }
- return;
- }
- }
- foreach my $u (keys %hash) {
- hf($u);
- }
- sub hf{
- my $mainPageURL = shift @_;
- $n=0 if $n >@text;
- $CLIP=$text[++$n];
-
- $ie->gotoURL($mainPageURL);
- my $windows = FindWindowLike(0, ".*U880.*");
- SetForegroundWindow($windows);
-
-
- # $ie->getTextBox('value:',"69521b95")->SetValue("989899898");
- # #$ie->getButton('value:',"replysubmit")->Click();
-
- SendKeys("{END}");
- SendKeys("{UP 10}");
- MouseMoveAbsPix(380, 480);#这个自己调整把,可以有更好的方法,就是填表单
- SetForegroundWindow($windows);
- sleep 4;
- SendMouse("{LEFTCLICK 2}");
- SendKeys("^(v)");
- SendKeys("^{ENTER}");
- sleep 18;
- }
复制代码
作者: 523066680 时间: 2015-6-3 19:36
自动登录的部分我有
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |