User:FACBot/tfa stats.pl


 * 1) !/usr/bin/perl -w
 * 2) Handle the recent list in TFAs

use English; use strict; use utf8; use warnings;

use Carp; use Date::Parse; use DateTime; use DateTime::Duration; use Data::Dumper;

use Cred; use MilHist::ArticleHistory; use MilHist::Bot; use MilHist::PageViews; use MilHist::Parser; use MilHist::Table;

binmode (STDERR, ':utf8'); binmode (STDOUT, ':utf8');

my $cred = new Cred ;

my $editor = MilHist::Bot->new ($cred) or  die "new MediaWiki::Bot failed";

sub age ($) { my ($date, $promoted) = @ARG; my $age = sprintf '', $promoted->year, $promoted->month, $promoted->day , $date->year, $date->month , $date->day ; return $age; }

sub article ($) { my ($day) = @ARG; my $date = $day->strftime ("%B %d, %Y"); $date =~ s/ 0/ /; my $tfa = "Wikipedia:Today's featured article/$date"; my $text = $editor->fetch ($tfa); my $article; foreach ($text) { s///; s///; if (/\[\[\s*(.+?)[\]\
 * 1)   print $tfa, "\n";