--- trunk/bin/isi-download-results.pl 2009/09/19 22:54:45 1294 +++ trunk/bin/isi-download-results.pl 2010/04/18 11:04:49 1332 @@ -3,12 +3,19 @@ use warnings; use strict; +use WWW::Mechanize; +use Data::Dump qw(dump); +use File::Path; +use Text::Unaccent; + # Advanced search syntax: # http://images.isiknowledge.com/WOK46/help/WOS/h_advanced_examples.html our $q = 'AD=Croatia'; my $range_size = 500; my $overlap = 3; # between previous and this range +my $skip_results = 0; +my $cites_by_year = 0; my $max_cites = 5000; # ISI limit to get cites @@ -19,9 +26,7 @@ $max_cites = 50; } -use WWW::Mechanize; -use Data::Dump qw(dump); -use File::Path; +$q = unac_string( 'utf-8', join(' ', @ARGV) ) if @ARGV; our $mech = WWW::Mechanize->new( autocheck => 1, @@ -32,8 +37,8 @@ our @ranges; my $dir = '/tmp/isi/'; -rmtree $dir if -e $dir; -mkdir $dir; +#rmtree $dir if -e $dir; +mkdir $dir unless -d $dir; sub save_mech { my $path = shift; @@ -169,10 +174,17 @@ my @y = sort keys %$years; + @ranges = (); + + if ( $cites_by_year ) { + push @ranges, [ $_ ] foreach @y; + warn "# cites_by_year ranges ", dump @ranges; + return; + } + my $y = shift @y; my $size = $years->{$y}; - @ranges = (); my $cites_range; $cites_range = [$y] if $y; @@ -201,7 +213,7 @@ search; years; -get_results; +get_results unless $skip_results; citations;