2013年2月15日 星期五

使用WWW-Mechanize-Firefox取得sciencedirect頁面資訊

use WWW::Mechanize::Firefox;
use Data::Dumper;
use Test::More;
local $Data::Dumper::Terse = 1;
my $mech = WWW::Mechanize::Firefox->new(
    tab => qr/^ScienceDirect/,
);
diag $_->{tagName} .":". $_->{id}#.":". $_->{class}#.":". $_->{class} #. "\n"
    for $mech->document->__xpath('/html/BODY/div');
print "_____export bib / save pdf\n";
diag $_->{tagName} .":". $_->{id} .":". $_->{innerHTML}
    for $mech->document->__xpath('/html/BODY/div[@id="page-area"]/div[@id="articleToolbar"]/div[@id="articleNav"]/ul/li[position()=2 or position()=3]');
print "_____bib _____\n";
diag $_->{tagName} .":". $_->{id} .":". $_->{innerHTML}
    for $mech->document->__xpath('/html/BODY/div[@id="page-area"]/div[@id="rightPane"]/div[@id="rightInner"]/div[@id="ui-accordion-rightInner-panel-0"]/div/dl/*');
print "_____html article_____\n";
diag $_->{tagName} .":". $_->{id}
    for $mech->document->__xpath('/html/BODY/div[@id="page-area"]/div[@id="centerPane"]/div[@id="centerInner"]/*');

沒有留言:

張貼留言