Utilisateur:KelBot/kbls
Apparence
<syntaxhighlight lang="perl">
- !/usr/bin/perl
use KelBot; use strict; use Getopt::Long;
my $pw;
my $category; my $all;
GetOptions('category=s' => \$category, 'all' => \$all);
if ($category) {
kbls($category);
} else {
unless ($category) {
while ($category = <STDIN>) { $category =~ s/\n//; kbls($category); }
}
}
sub kbls {
my $category = shift; return unless ($category);
unless ($pw) {
$pw = KelBot->new('kbls'); $pw->login();
} $category = `php -q ./urlencode.php "$category"`;
foreach my $page ($pw->get_pages_in_category("category:$category") ) {
$page =~ s/ /_/g; unless ($all) { next unless ($pw->encyclo($page)); } print $page."\n";
}
}