Skip to content

Instantly share code, notes, and snippets.

@lopnor
Created September 3, 2011 07:49
Show Gist options
  • Save lopnor/1190811 to your computer and use it in GitHub Desktop.
Save lopnor/1190811 to your computer and use it in GitHub Desktop.
#!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