ablog

不器用で落着きのない技術者のメモ

form の hidden をスクレイピングしたメモ

#!/usr/bin/env perl
use strict;
use warnings;
use WWW::Mechanize;
use Web::Scraper;

my $mech = 'WWW::Mechanize'->new('autocheck', 1, agent =>'Mozilla/5.0');
$mech->get('https://...');

my $scraper = scraper {
	process '/html/body/form/input[1]', 'site2pstoretoken' => '@value';
	process '/html/body/form/input[2]', 'v' => '@value';
	process '/html/body/form/input[3]', 'p_submit_url' => '@value';
};

my $res = $scraper->scrape($mech->content);

print "$res->{site2pstoretoken}\n";
print "$res->{v}\n";
print "$res->{p_submit_url}\n";

__END__