download full results from ISI
authorDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 18 Sep 2009 16:52:57 +0000 (16:52 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 18 Sep 2009 16:52:57 +0000 (16:52 +0000)
git-svn-id: svn+ssh://mjesec/home/dpavlin/svn/webpac2/trunk@1280 07558da8-63fa-0310-ba24-9fe276d99e06

bin/isi-download-results.pl [new file with mode: 0755]

diff --git a/bin/isi-download-results.pl b/bin/isi-download-results.pl
new file mode 100755 (executable)
index 0000000..95bfd43
--- /dev/null
@@ -0,0 +1,75 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+my $q = 'TS=psychology AND AD=Croatia';
+
+use WWW::Mechanize;
+use Data::Dump qw/dump/;
+use File::Slurp;
+
+my $mech = WWW::Mechanize->new(
+       autocheck => 1,
+       cookie_jar => undef,
+);
+
+my $step = 1;
+
+sub save_mech {
+       my $mech = shift;
+       my $path = "/tmp/isi.$step.html";
+       write_file $path, $mech->content;
+       warn "# step $step ", -s $path;
+       $mech->dump_all;
+       $step++;
+}
+
+warn "# get session";
+$mech->get( 'http://isiknowledge.com/?DestApp=WOS' );
+save_mech $mech;
+
+warn "# advanced serach";
+$mech->follow_link( url_regex => qr/AdvancedSearch/ );
+save_mech $mech;
+
+warn "# cookie_jar ", dump $mech->cookie_jar;
+
+$mech->submit_form(
+       fields => {
+               'value(input1)' => $q,
+       }
+);
+save_mech $mech;
+
+warn "# summary";
+$mech->follow_link( url_regex => qr/summary/ );
+save_mech $mech;
+
+my $from = 1;
+my $range_size = 10;
+
+$mech->submit_form(
+       form_name => 'summary_output_form',
+       fields => {
+               record_select_type => 'range',
+               mark_from => $from,
+               mark_to => $from += $range_size,
+               mark_id => 'WOS',
+
+               qo_fields => 'fullrecord',
+               citedref => 'citedref',
+
+               save_options => 'plain_text',
+
+               fields => 'Full',
+               format => 'save',
+       },
+       button => 'save',
+);
+save_mech $mech;
+
+warn "# save_file";
+$mech->follow_link( url_regex => qr/save_file/ );
+save_mech $mech;
+