写了一个perl脚本来监听 的最新消息,最近办理房产证的事情把我们业主给搞惨了。该死的kfs。
#!C:\strawberry\perl\bin\perl.exe use warnings; use strict; use LWP::UserAgent; use CGI;
# # # 家园动态 # my $cgi = CGI->new();
my $ua = LWP::UserAgent->new('agent' => 'Mozilla/5.0'); my $page_response = $ua->get(''); die 'Http get failed', "\n" unless $page_response->is_success; my @lks = (); my $nd = $cgi->param('d') || 3; for ($page_response->content =~ m/(<tbody id=\"(normal|stick)thread_\d+\" >.*?<\/tbody>)/sg) { s#\n##gs; s#href="#href=" s#src="#src=" for (my $i = 0; $i < $nd; $i++) { my (undef,undef,undef,$_d,$_m,$_y,undef,undef,undef) = localtime(time - 3600 * 24 * $i); $_y += 1900; $_m += 1; push @lks, $_ if m/<em>$_y-$_m-$_d<\/em>/; } } print $cgi->header('text/html; charset=utf-8'); print qq( <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ""> <html xmlns=""> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Language" content="zh-CN" /> <meta http-equiv="Refresh" content="60" /> <meta name="Keywords" content="" /> <meta name="Description" content="" /> <title>perl FOR hlghome</title> <style> body {font-size: 12px; margin: auto; text-align: center;} img {border: none;} a, a:visited {color: blue;} table {border: 1px solid gray; margin: 10px auto;} </style> </head> <body> ); print "", "\n"; for (@lks) { print $_, "\n"; } print " ", "\n"; print qq( </body> </html> );
|
阅读(623) | 评论(1) | 转发(0) |