Skip to content

Instantly share code, notes, and snippets.

@cnaude
Last active August 20, 2016 02:48
Show Gist options
  • Save cnaude/6119537 to your computer and use it in GitHub Desktop.
Save cnaude/6119537 to your computer and use it in GitHub Desktop.
Parse output from http://forums.bukkit.org/members/?page=$i and sort by number of likes.
#!/usr/bin/perl
use strict;
for my $i (1..16420) {
system("wget -O data/bf.$i.html 'http://forums.bukkit.org/members/?page=$i'");
sleep 2;
}
#!/usr/bin/perl
#
use strict;
open (FILE, "zcat data/big.list.gz|") or die $!;
my %hash = {};
while (<FILE>) {
if (/something posted by (.*?) has been 'liked'">Likes Received.*?<dd>(.*?)<\/dd>/) {
$hash{$1} = $2;
$hash{$1} =~ s/,//g;
}
}
close FILE;
sub hashValueDescendingNum {
$hash{$b} <=> $hash{$a};
}
my $count = 1;
foreach my $key (sort hashValueDescendingNum (keys(%hash))) {
print "$count: $hash{$key} $key\n";
$count ++;
}
#!/usr/bin/perl
#
use strict;
open (FILE, "zcat data/big.list.gz|") or die $!;
my %hash = {};
while (<FILE>) {
if (/<dt title="Total messages posted by (.*?)">Messages:<\/dt> <dd>(.*?)<\/dd>/) {
$hash{$1} = $2;
$hash{$1} =~ s/,//g;
}
}
close FILE;
sub hashValueDescendingNum {
$hash{$b} <=> $hash{$a};
}
my $count = 1;
foreach my $key (sort hashValueDescendingNum (keys(%hash))) {
print "$count: $hash{$key} $key\n";
$count ++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment