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