/[webpac2]/trunk/bin/isi-download-results.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/bin/isi-download-results.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1288 by dpavlin, Fri Sep 18 17:46:04 2009 UTC revision 1289 by dpavlin, Sat Sep 19 10:23:35 2009 UTC
# Line 3  Line 3 
3  use warnings;  use warnings;
4  use strict;  use strict;
5    
6  my $q = 'TS=psychology AND AD=Croatia';  my $q = 'AD=Croatia';
7  my $range_size = 50;  my $range_size = 500;
8    
9  my $dump = @ARGV ? 1 : 0;  my $dump = @ARGV ? 1 : 0;
10    
11  $q = 'AD=Croatia';  $q = 'TS=psychology AND AD=Croatia';
 $range_size = 500;  
12    
13  use WWW::Mechanize;  use WWW::Mechanize;
14  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
15    
16  my $mech = WWW::Mechanize->new(  our $mech = WWW::Mechanize->new(
17          autocheck => 1,          autocheck => 1,
18          cookie_jar => undef,          cookie_jar => undef,
19  );  );
# Line 51  warn "# summary"; Line 50  warn "# summary";
50  $mech->follow_link( url_regex => qr/summary/ );  $mech->follow_link( url_regex => qr/summary/ );
51  save_mech $mech;  save_mech $mech;
52    
53  my $from = 1;  sub get_results {
54            my $q = shift;
55            my $from = 1;
56    
57            while ( 1 ) {
58    
59                    my $to = $from + $range_size;
60    
61                    $mech->submit_form(
62                            form_name => 'summary_output_form',
63                            fields => {
64                                    record_select_type => 'range',
65                                    mark_from => $from,
66                                    mark_to => $to,
67                                    mark_id => 'WOS',
68    
69                                    qo_fields => 'fullrecord',
70                                    citedref => 'citedref',
71    
72                                    save_options => 'plain_text',
73    
74                                    fields => 'Full',
75                                    format => 'save',
76                            },
77                            button => 'save',
78                    );
79                    save_mech $mech;
80    
81                    if ( $mech->content =~ m{invalid API call} ) {
82                            $mech->back;
83                            return;
84                    }
85    
86                    warn "# save_file $from - $to [$q]";
87                    $mech->follow_link( url_regex => qr/save_file/ );
88                    save_mech $mech => "/tmp/isi.$q.$from-$to.txt";
89    
90                    $from += $range_size;
91    
92                    $mech->back;
93                    $mech->back;
94                    #save_mech $mech;
95    
96  while ( $from ) {          } # while
97    
98          my $to = $from + $range_size;  }
   
         $mech->submit_form(  
                 form_name => 'summary_output_form',  
                 fields => {  
                         record_select_type => 'range',  
                         mark_from => $from,  
                         mark_to => $to,  
                         mark_id => 'WOS',  
   
                         qo_fields => 'fullrecord',  
                         citedref => 'citedref',  
   
                         save_options => 'plain_text',  
   
                         fields => 'Full',  
                         format => 'save',  
                 },  
                 button => 'save',  
         );  
         save_mech $mech;  
99    
100          last if $mech->content =~ m{invalid API call};  get_results $q;
101    
102          warn "# save_file";  save_mech $mech;
103          $mech->follow_link( url_regex => qr/save_file/ );  warn "# citations";
104          save_mech $mech => "/tmp/isi.$q.$from-$to.txt";  $mech->follow_link( url_regex => qr/search_mode=CitationReport/ );
105    save_mech $mech;
106    
107          $from += $range_size;  $mech->follow_link( url_regex => qr/search_mode=TotalCitingArticles/ );
108    save_mech $mech;
109    
110          $mech->back;  get_results $q . '.citing';
         $mech->back;  
         #save_mech $mech;  
111    
 }  

Legend:
Removed from v.1288  
changed lines
  Added in v.1289

  ViewVC Help
Powered by ViewVC 1.1.26