From 1b82dcd6eb9d8c60263cfe137a30bebabd4dd49c Mon Sep 17 00:00:00 2001 From: Astrid Smith Date: Fri, 17 Sep 2010 17:07:16 -0700 Subject: Works now, except RCS is a dick and doesn't like usernames with spaces in them --- wikiscraper.pl | 48 +++++++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/wikiscraper.pl b/wikiscraper.pl index 3fdce75..7da198f 100755 --- a/wikiscraper.pl +++ b/wikiscraper.pl @@ -5,32 +5,30 @@ use warnings; use strict; -require MediaWiki::API; +require MediaWiki::DumpFile::Pages; -my $api_url = shift @ARGV; -# http://wikiti.brandonw.net/api.php - -my $page = shift @ARGV; +my $dumpfile = MediaWiki::DumpFile::Pages->new(shift @ARGV); # 83Plus:Ports:57 -my $name = shift @ARGV; -my $password = shift @ARGV; - -my $mw = MediaWiki::API->new( { api_url => $api_url } ); -print $api_url, "\n"; -#$mw->login( { lgname => $name, -# lgpassword => $password } ) -# || die $mw->{error}->{code} . ': ' . $mw->{error}->{details}; - -my $revs = $mw->api( - { action => 'query', - prop => 'categorymembers', - cmtitle => 'Category:68k', - cmlimit => 'max', - } ); - -print join('**', %$revs->{'warnings'}), "\n"; - -foreach (@{$revs}) { - print "$_->{title}\n"; +while (defined (my $page = $dumpfile->next)) +{ + my @revs = $page->revision; + + foreach (@revs) { + open (FILE, ">", $page->title); + print FILE $_->text; + close FILE; + my @command = ("ci", + "-t-" . $page->title, + "-d" . $_->timestamp, + ($_->comment ne "" ? "-m" . $_->comment : "-mNo message"), + "-r" . $_->id, + "-w" . $_->contributor->astext, + "-l", + $page->title, + ); + + system(@command); + print join " ", @command, "\n"; + } } -- cgit v1.2.3