updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / arch-wiki-docs-fr / index.pl
blob81f9004885eaba137cb08c356b8cf64a15c94f43
1 #!/usr/bin/perl -w
3 use Encode;
4 use JSON::XS;
6 $URL=$ARGV[0];
8 @ALLPAGES=();
10 my $pageid;
11 my $pagetitle;
12 my $from = "";
13 my $ret;
14 again:
15 my $count = 0;
16 #print STDERR "wget -q \"$URL/api.php?action=query&list=allpages&aplimit=500&format=json&apfilterredir=nonredirects&apfrom=$from\" -O -\n";
17 $text=`wget -q \"$URL/api.php?action=query&list=allpages&aplimit=500&format=json&apfilterredir=nonredirects&apfrom=$from\" -O -`;
18 $ret = JSON::XS->new->utf8->decode($text);
19 $H = $ret->{query}->{allpages};
20 foreach $i (@$H)
22 push @ALLPAGES, encode("UTF-8", "$i->{title}");
23 printf("%08u %s", $i->{pageid}, encode("UTF-8", "$i->{title}\n"));
24 $count++;
27 if($count == 1)
29 exit 0;
32 @ALLPAGES = sort @ALLPAGES;
33 $from = $ALLPAGES[-1];
34 goto again;