Wikipedia:Scripts/Perl scripts/Pagestats

From Wikipedia, the free encyclopedia
# "Pagestats". This script grabs the page traffic statistic for each Wikipedia page on a list, and adds it to a cumulative total.
# By R. Farmbrough, 2011, licensed GFDL and CCBYSA 3.0
use LWP::Simple;

$month = "09";
$year = "2011";
$lang="en";

while (<>){
    s/ /_/g;	
    print "$_";
    $page=get ("http://stats.grok.se/$lang/$year$month/$_" );
    $page =~ /has been viewed (\d+) times in/;
    $total+=$1;
    print " $total\n ";    
}

print "\nTotal: $total";