Created
April 2, 2011 10:50
-
-
Save kyanny/899395 to your computer and use it in GitHub Desktop.
stackoverflow-reputation-score.pl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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