Jump to content

Wikipedia:Scripts/Perl scripts

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by The Transhumanist (talk | contribs) at 01:05, 11 December 2011 (first deposit). 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.

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