Perl Script to check Google pagerank

In order to find out a Google Pagerank of a webpage, we can use the WWW::Google::PageRank module in Perl.

Click WWW::Google::PageRank to download the Google Pagerank module. Here is a simple script that takes the Website URL as a command line argument and prints the Google PageRank. OR Alternatively you can install the module using cpan

cpan -i WWW::Google::PageRank

#!/usr/bin/perl $webpage = $ARGV[0]; use WWW::Google::PageRank; my $pagerank = WWW::Google::PageRank->new; print scalar($pagerank->get($webpage)), "\n";

Usage of Perl Script to check PageRank


Getting Google Pagerank of Pages in Bulk

The following PERL script can be used to get pageranks of pages in bulk. Just pass the filename which has URLs in each line and it would output the pageranks of those pages as a CSV. #!/usr/bin/perl $file = $ARGV[0]; use WWW::Google::PageRank; my $pagerank = WWW::Google::PageRank->new; sub trim($) { my $string = shift; $string =~ s/^\s+//; $string =~ s/\s+$//; return $string; } open FILE,"<",$file; while(<FILE>) { if(/http:\/\/([^\/]+)/) { $webpage = "http://$1"; print $webpage . "," . scalar($pagerank->get($webpage)). "\n"; sleep 1; } } close(FILE); 11 May, 2010
Comments (1)
  • I have a lot of admiration

    I have a lot of admiration when I see content articles by other people who are more of an expert than me on this topic. The audience might think this looks effortless, but there is so much going on behind the curtain. Your work is a result of homework and knowledge on your part and you were really kind enough to share all of them with people like me. Thanks.

    By photographie de mariage on 04 Jun, 2011
You may also like
On Facebook
Email Newsletter