I would like to use bibTex data in a perl script from google scholar.
These data are controlled in google scholar with the preference panel
wich use cookies to remember the user's settings. bibTex are not
displayed with the default settings.

Using the perl script I receive an empty page with the following url
despite I try to set the same cookie as the cookie sets in my browser
when "display bibTex links" is on.
The same url give what I want if I send it in my browser with the
correct preferences.

My code goes like this:
 my $url1="http://scholar.google.com/scholar.bib?
 my $ua = LWP::UserAgent->new;
 $ua->agent('Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:
Gecko/20071025 Firefox/');
 my $c = HTTP::Cookies::Netscape->new(file=>"cookies.txt",
 my $h = HTTP::Headers->new(
            Accept => "text/xml,application/xml,application/xhtml+xml,text/
            Host => "www.unifr.ch",
my $req =HTTP::Request->new(GET=>$url1,$h);
 my $res =$ua->request($req);
 die ($res->status_line) unless ($res->is_success);
print $res->as_string;

The output is
HTTP/1.1 200 OK
Cache-Control: private
Connection: Close
Date: Fri, 09 Nov 2007 16:04:42 GMT
Server: GWS/2.1
Content-Length: 0
Content-Type: text/plain; charset=ISO-8859-1
Client-Date: Fri, 09 Nov 2007 16:04:44 GMT
Client-Response-Num: 1
expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com
Set-Cookie: GSP=ID=8d4ee7c002f1dc72; expires=Sun, 17-Jan-2038 19:14:07
GMT; path=/; domain=.scholar.unifr.ch

The relevant line in my cookies file use by the script is
.scholar.google.com     TRUE    /       FALSE   2147368448      GSP

The cookie data from my browser are
name: GSP
Value: ID=c77566a14ed11a16:IN=7e6cc990821af63+b8acc395c41ea61f:CF=4
Domain: .scholar.google.com
Path: /

Well the cookie from the script output seems to be different form the
cookie I want to send. This is maybe the reason of my empty page but I
can't understand why that cookie is changed ...

Thanks for any help !


Reply via email to