Skip to content

Instantly share code, notes, and snippets.

@typester
Created January 9, 2009 06:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save typester/45043 to your computer and use it in GitHub Desktop.
Save typester/45043 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use Config::Pit;
use Net::Growl;
use WWW::Mechanize;
my $conf = pit_get('outputz.com', require => { key => 'your outputz secret key' });
my $mech = WWW::Mechanize->new( stack_depth => 1 );
$mech->get('http://outputz.com/daily');
$mech->follow_link(url_regex => qr/config/);
$mech->submit_form(
fields => {
magic_word => $conf->{key},
},
);
unless ($mech->content =~ /$conf->{key}/) {
die 'login failed';
}
$mech->get('http://outputz.com/daily');
my ($rank, $info) = $mech->content =~ m!<p class="ranking">(\d+)<span class="ranking_info">(.*?)</span></p>!;
die 'html parse failes' unless $rank && $info;
my $gconf = pit_get('growl', require => { password => 'your growl network password' });
register(
host => '127.0.0.1',
application => 'outputz notifier',
password => $gconf->{password},
);
notify(
application => 'outputz notifier',
title => 'this hour outputz rank',
description => $rank . $info,
password => $gconf->{password},
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment