#!/usr/local/bin/perl #analtimes use LWP::UserAgent; print qq|Content-type: text/html\n\n|; print qq|test



\n|; my $adult = new Fc2ranking "ƒAƒ_ƒ‹ƒg","460000","2"; print $adult->getdata; print qq|



\n|; package Fc2ranking; sub new{ my $class = shift; my ( $cate_name, $id, $page ) = @_ ; my $self = {"cate_name" => $cate_name , "id" => $id , "page" => $page }; bless $self, $class; return $self; } sub getdata{ my $self = shift; my $fc2url="http://blogranking.fc2.com/rank/"; my $page_no=1; for(1..$self->{page}){ my $url = $fc2url. $self->{id} .'_'.$page_no.'.html'; my $ua = LWP::UserAgent->new; $ua->agent('Mozilla/5.0 (compatible; MSIE 6.00; Windows NT 5.0)'); my $request = HTTP::Request->new('GET' , $url); $request->header('Referer', $url); my $response = $ua->request($request); my $body = $response->content; my $new_gif=""; my @line = split (/\n/ , $body); my $ln; foreach $ln (@line) { if ($ln =~ /
(.*?)<\/a><\/div>/ ) { $blog_url = $1; $blog_title = $2; print "
$blog_title<\/a>\n"; } elsif ($ln =~ /
$new_gif(.*?)<\/a><\/div>/ ) { $blog_url = $1; $blog_title = $2; print "
$blog_title<\/a>\n"; } elsif ($ln =~/(.*?)<\/td>/ ) { $week_in =$1; print "$week_in,"; } elsif ($ln =~/(.*?)<\/td>/ ) { $week_in =$1; print "$week_in,"; } } $page_no++; } }