-
-
Save clairvy/211498 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
# -*- coding: utf-8-unix; -*- | |
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 = '' unless (defined($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