summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAstrid Smith2010-09-17 17:07:16 -0700
committerAstrid Smith2010-09-17 17:07:16 -0700
commit1b82dcd6eb9d8c60263cfe137a30bebabd4dd49c (patch)
tree617828d70bfecfafb41acaf023d1213c237e1859
parent69a0eeebd89686a350e43a4764fbe2cfc000c35c (diff)
Works now, except RCS is a dick and doesn't like usernames with spaces in them
-rwxr-xr-xwikiscraper.pl48
1 files 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";
+ }
}