Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/perl
# http://www.simplisticcomplexity.com/2008/03/05/cleanly-migrate-your-subversion-repository-to-a-git-repository/
use strict;
use warnings;
use Web::Scraper;
use URI::Escape;
use URI;
$| = 1;
my %authors;
while (<>) {
/^r\d+\s*\|\s*(\S+)/ or next;
unless (exists $authors{$1}) {
$authors{$1} = github_info($1);
}
}
sub github_info {
my $username = shift;
my $scraper = scraper {
process "#profile_name", name => 'TEXT';
process ".email", email => [ 'HTML', \&unmangle_js ];
};
my $res = eval { $scraper->scrape(URI->new("http://github.com/$username")) };
if ($res->{name} && $res->{email}) {
print "$username = $res->{name} <$res->{email}>\n";
}
return "blah";
}
sub unmangle_js {
/decodeURIComponent\(&#39;([%0-9a-f]+)/;
my $code = uri_unescape($1);
$code =~ /mailto:(.*?)"/ and return $1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.