📄 t_piaokuxun.pl
字号:
#!c:\perl\bin\perl.exe -w
use strict;
#use Digest::MD5;
#use LWP::UserAgent;
#use HTTP::Cookies;
#
#my $cookie = HTTP::Cookies->new( file=>'cookie.txt',autosave=>1,ignore_discard=>'1');
#my $us= LWP::UserAgent->new;
#$us->cookie_jar($cookie);
#$us->agent('Mozilla/4.0');
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
#$ua->timeout(10);
$ua->env_proxy;
my $rooturl='';
while( 1 ){
sleep 20;
my $response = $ua->get('http://piao.kuxun.cn/search.php?T=Ticket&Cat=sale&From=%E5%8C%97%E4%BA%AC&q=%E8%8F%8F%E6%B3%BD&Cat1=1%E6%9C%88&Cat3=8%E6%97%A5&start=0');
if ($response->is_success) {
my $ret = &kuxun($response->content);
if( $ret ne '' ){
open F,">> c:\\piao_kuxun.txt";
print F $ret,"\n====================\n";
close F;
print $ret,"\n====================\n";
foreach( 1..3 ){
system('c:\windows\notepad.exe c:\piao_kuxun.txt');
}
last;
}else{
print &getLocaltime."\t搜索中 北京-菏泽 ...\n";
# sleep 20;
next;
}
# open F, "> url.txt";
# print F $response->content; # or whatever
# close F;
}
else {
#die $response->status_line;
}
#sleep 20;
}
print "\nok\n";
sub kuxun($)
{
my $body = shift;
my $st = index($body,'<div class="back">',10524);
my $count=0;
my $ret='';
if( defined($st) ){
$body = substr($body,$st,23877);
#href="http://piao.kuxun.cn/Go_T_Ticket.fromuser_.r_0.kxlog_kxPos.From_%E5%8C%97%E4%BA%AC.OffSet_737632795/http://www.huochepiao.com.cn/huochepiao/display.asp?DirectoryID=1420958" title="[转让] T31 北京-杭州 硬座 2张 发车日期:9-28" target="_blank">[转让] T31 北京-杭州 硬座 2张 发车日期:9-28</a>
my @array = split /\n/, $body;
foreach( @array){
if( m![\t ]+.*href=\"(.*)\" title=\"(.*)\" target! ){
my($u,$t) = ($1,$2);
if( 0<index($u,'xiangqing.asp?id=94727') ){
last;
}
#
# next if( $3 le '2008-9-27');
print "$u\n$t\n\n";
if($t=~m/1487 /ig || $t=~m/1503/ig || $t=~m/1504/ig
|| $t=~m/1621 /ig
|| $t=~m/2071/ig || $t=~m/2074/ig
|| $t=~m/l271 /ig || $t=~m/l +271/ig
|| $t=~m/k105 /ig || $t=~m/k +105/ig
){
#print "$u\n$t\n\n";
$ret .= $rooturl."$u\n$t\n\n";
$count += 1;
}else{
next;
}
}
#last;
}
}
return $ret;
}
sub getLocaltime()
{
my ($sec,$min,$hour,$day,$mon,$year) = localtime;
my $formatTime = sprintf "%4d/%02d/%02d %02d:%02d:%02d", $year+1900, $mon+1, $day, $hour, $min, $sec;
return $formatTime;
}
#use LWP::Simple;
#
#my $content = get('http://hi.baidu.com/ixigua');
##print $content;
#
##@links=grep { $_ !~ /baidu.com|ie=gb2312|^#/} @links;
##只取不包含baidu.com,ie=gb2312,和不以#开头的值,重新push到@links
#
#
##my @links = grep { $content=~m/http:\/\/hi\.baidu\.com/isg } $content;
#my @array = split(/\n/, $content);
#print $array[0],"\n";
#@array=grep { $_ =~ /ixigua/} @array;
#foreach( @array ){
## print $_,"\n";
# if( m!href=\"(.*)\" ! ){
# print $1,"\n";
# }
#}
#my $cookie = HTTP::Cookies->new( file =>"cookie.txt",autosave => 1,ignore_discard =>'1');
#my $ua = LWP::UserAgent->new;
# my $cookie = HTTP::Cookies->new( file =>"cookie.txt",autosave => 1,ignore_discard =>'1');
# 22 my $ua = LWP::UserAgent->new;
# 23 $ua->cookie_jar($cookie);
# 24 $ua->agent("Mozilla/4.0");
#R郑原斌 说:
#然后其他就一样了
#Zachary 说:
#哦,还有一点不明白,帐号及密码在哪里输入
#R郑原斌 说:
#你再用 use HTTP::Request::Common;
#use File::Copy;
#
#my $path = 'c:\windows\notepad.exe';
#print copy($path,"test.exe");
#my $filepath = 'C:\DOCUME~1\ZHANGZ~1\LOCALS~1\TEMP\NSa9.TMP\zhang';
#my $loginuser = 'ZHANGZENGXIAN';
#if( length($loginuser)>8 ){
# $loginuser = substr($loginuser,0,6).'~1';
# print $loginuser,"\n";
#}
#if( $filepath=~m/^[CD]:\\DOCUME~1\\ADMINI~1\\LOCALS~1\\TEMP\\NS\w\d\.TMP\\\w+/
# ||$filepath=~m/^[CD]:\\DOCUME~1\\${loginuser}\\LOCALS~1\\TEMP\\NS\w\d\.TMP\\\w+/
# ||$filepath=~m/^[CD]:\\WINDOWS\\TEMP\\NS\w\d.TMP/
#){
# print "ok";
#}
#my %gConfig = ('checkDS'=>'CheckDigitalSignature.exe','checkDSmd5'=>'A1B72945E1587D892275F6AB608D0249');
#my $path = 'C:\3\'rdParty\DirectX 9.0c Redist March 2008.exe';
#
#print &checkDigitalSignature(\%gConfig, $path);
#
#
#sub checkDigitalSignature($$)
#{
# my ($gConfig, $filepath) = @_;
# #die "error:检查壳的程序不存在!" if( ! -e $gConfig->{"checkDS"} );
# return 0 if( ! -e $gConfig->{"checkDS"} );
# die "error:检查版本号的程序可能被感染!" if( uc($gConfig->{"checkDSmd5"}) ne &getMD5($gConfig->{"checkDS"}) );
#
# unlink $filepath."_checked.txt";
# system( $gConfig->{"checkDS"}." \"".$filepath."\"" );
# if(-e $filepath."_checked.txt"){
# open FILE,"<", $filepath."_checked.txt" or return 0;
# my $line = <FILE>;
# close FILE;
# unlink $filepath."_checked.txt";
# if( $line eq 'yes'){
# return 1;
# }else{
# return 0;
# }
# }else{
# print "not find txt\n";
# return 0;
# }
#}
#sub getMD5($)
#{
# my $filepath = shift;
# open FILE, $filepath;
# binmode(FILE);
# my $strMD5 = Digest::MD5->new->addfile(*FILE)->hexdigest;
# close(FILE);
# return uc($strMD5);
#}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -