Created
September 3, 2011 07:49
-
-
Save lopnor/1190811 to your computer and use it in GitHub Desktop.
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
#!perl | |
use strict; | |
use warnings; | |
use Config::Pit; | |
use Web::Scraper; | |
use URI; | |
use WWW::Mechanize; | |
use Data::Dumper; | |
my $config = pit_get('saisoncard.co.jp'); | |
my $mech = WWW::Mechanize->new; | |
{ | |
$mech->get('https://netanswerplus.saisoncard.co.jp/WebPc/welcomeSCR.do'); | |
$mech->submit_form( | |
form_name => '_USA01Form', | |
fields => { | |
inputId => $config->{username}, | |
inputPassword => $config->{password}, | |
}, | |
button => 'login', | |
); | |
} | |
{ | |
my $link = scraper { | |
process '//div[@id="svMenu"]/ul/li[1]/a' => 'link' => '@href'; | |
result 'link'; | |
}->scrape($mech->res->content, $mech->uri); | |
$mech->get($link); | |
} | |
{ | |
my $link = scraper { | |
process '//div[@class="csv clearfix"]/ul/li[1]/a' => 'link' => '@href'; | |
result 'link'; | |
}->scrape($mech->res->content, $mech->uri); | |
$mech->get($link); | |
print $mech->res->decoded_content; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment