Jump to content

Wikipedia:Scripts/Perl scripts

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Rich Farmbrough (talk | contribs) at 18:27, 28 December 2011 (Pagestats). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

This is a repository for Wikipedia-related perl scripts.

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";