views:

172

answers:

2

I would like to save a csv file from a web page. However, the link on the page does not lead directly to the file, but it calls some kind of javascript, which leads to the opening of the file. In other words, there is no explicit url address for the file i want to download or at least I don't know what it should be. I found a way to download a file by activating Internet Explorer,going to the web page and pressing the link button and then saving the file through the dialog box. This is pretty ugly, and I am wondering if there is a more elegant (and fast) method to retrieve a file without using internet explorer(e.g. by using urllib.retrieve method) The javascript is of the following form (see the comment, it does not let publish the source code...):

"CSV"

Any ideas?

Sasha

+1  A: 

You can look at what the javascript function is doing, and it should tell you exactly where it's downloading from.

Sev
Look in the source of the page for the "customWindowOpen()" function
jjclarkson
Was this a comment meant for the original poster, maybe?
Sev
Sasha
A: 

I had exactly this sort of problem a year or two back; I ended up installing the rhino javascript engine; grepping the javascript out of the target document and evaluating the url within rhino, and then fetching the result.

Kyle W. Cartmell