Skip to content

Instantly share code, notes, and snippets.

@kyanny
Created April 2, 2011 10:50
Show Gist options
  • Save kyanny/899395 to your computer and use it in GitHub Desktop.
Save kyanny/899395 to your computer and use it in GitHub Desktop.
stackoverflow-reputation-score.pl
#!/usr/bin/env perl
use strict;
use warnings;
use Web::Scraper;
use URI;
use Config::Pit;
use Net::Amazon::S3;
my $flair = 'http://stackoverflow.com/users/flair/374851.html';
my $scraper = scraper {
process '.reputation-score', 'reputation' => 'TEXT';
};
my $result = $scraper->scrape(URI->new($flair));
my $reputation = $result->{reputation};
`convert -font Times-Roman -pointsize 16 label:$reputation stackoverflow-reputation-score.png`;
my $config = pit_get('s3.amazonaws.com');
my $s3 = Net::Amazon::S3->new(
%$config,
retry => 1,
);
my $client = Net::Amazon::S3::Client->new(s3 => $s3);
my $bucket = $client->bucket(name => "kyanny");
my $object = $bucket->object(
key => 'stackoverflow-reputation-score.png',
acl_short => 'public-read',
content_type => 'image/png',
);
$object->put_filename('stackoverflow-reputation-score.png');
#print $object->uri, "\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment