Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tools/GetPagesAboveThreshold.pl
blob: 295f2e7611f3b9e42885dbe6232759737ecfe941 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/perl

use warnings;
use strict;

my $pagecounts = $ARGV[0];
my $threshold = $ARGV[1];
my $out = $ARGV[2];

my $outpages = $out . "_pages";
my $outlinks = $out . "_links";

open(IN,$pagecounts) or die "$pagecounts not available for reading!";
open(PAGES,">$outpages") or die "$outpages not available for writing!";


my @removepages = ("Wikipedia:","Ayuda:","Wikiproyecto:","MediaWiki:","Plantilla:","WP:","Portal:");

while (<IN>) {
  if (/(\d+).*\[\[(.*)\]\]/) {
    if ($1 > $threshold) {
      my $page = $2;
      my $good = 1;
      foreach my $remove (@removepages) {
        if ($page =~ /^$remove/) {
          $good = 0;
        }
      }
      if ($page eq "Portada") {
        $good = 0;
      }
      if ($good == 1) {
        print PAGES "$2\n";
      }
    }
  } else {
    die "WEIRD $_\n";
  }
}
close(IN);