/[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 1336 by dpavlin, Tue Jun 29 18:32:27 2010 UTC revision 1337 by dpavlin, Tue Jun 29 18:52:19 2010 UTC
# Line 217  sub years { Line 217  sub years {
217          return $years;          return $years;
218  }  }
219    
220    
221    our $page = 1;
222    sub next_page {
223            $page++;
224            warn "next_page $page\n";
225    
226            $mech->submit_form(
227                    form_name => 'summary_navigation',
228                    fields => {
229                            'page' => $page,
230                    },
231            );
232    
233            save_mech;
234    
235            $mech->form_name( 'summary_navigation' );
236            my $is_next_page = $mech->value('page') == $page;
237            warn "no next_page" unless $is_next_page;
238            return $is_next_page;
239    }
240    
241  if ( $results ) {  if ( $results ) {
242          search;          search;
243          years;          years;
# Line 241  if ( $citations ) { Line 262  if ( $citations ) {
262    
263  }  }
264    
265    
266    
267  if ( $q =~ m{CA=(.+)} && $cited_reference ) {  if ( $q =~ m{CA=(.+)} && $cited_reference ) {
268    
269          my $CA = $1;          my $CA = $1;
# Line 265  if ( $q =~ m{CA=(.+)} && $cited_referenc Line 288  if ( $q =~ m{CA=(.+)} && $cited_referenc
288          while (1) {          while (1) {
289                  save_mech "/tmp/isi.$q.citedref.$page";                  save_mech "/tmp/isi.$q.citedref.$page";
290    
291                  $page++;                  last unless next_page();
   
                 $mech->submit_form(  
                         form_name => 'summary_navigation',  
                         fields => {  
                                 'page' => $page,  
                         },  
                 );  
   
                 $mech->form_name( 'summary_navigation' );  
                 last if $mech->value('page') < $page;  
292    
293                  if ( $mech->content =~ m/(\d+\s*-\s*(\d+))/ ) {                  if ( $mech->content =~ m/(\d+\s*-\s*(\d+))/ ) {
294                          warn "span: $1\n";                          warn "span: $1\n";
# Line 298  if ( $q =~ m{CA=(.+)} && $citing_article Line 311  if ( $q =~ m{CA=(.+)} && $citing_article
311          my $orig_q = $q;          my $orig_q = $q;
312          my $nr = 0;          my $nr = 0;
313    
314            do {
315    
316          foreach my $link ( $mech->find_all_links( url_regex => qr/CitingArticles.do/ ) ) {          foreach my $link ( $mech->find_all_links( url_regex => qr/CitingArticles.do/ ) ) {
317                  $nr++;                  $nr++;
318                  warn "link $nr\n";                  warn "link $nr\n";
# Line 306  if ( $q =~ m{CA=(.+)} && $citing_article Line 321  if ( $q =~ m{CA=(.+)} && $citing_article
321                  $q = $orig_q . '.citing_article.' . $nr;                  $q = $orig_q . '.citing_article.' . $nr;
322                  get_results;                  get_results;
323                  $mech->back;                  $mech->back;
                 save_mech;  
324                  $mech->back;                  $mech->back;
325                  save_mech;  
326                    #last if $nr > 3; # FIXME only for development
327          }          }
328    
329            } while next_page;
330    
331          $q = $orig_q;          $q = $orig_q;
332  }  }
333    

Legend:
Removed from v.1336  
changed lines
  Added in v.1337

  ViewVC Help
Powered by ViewVC 1.1.26