0

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

6
  • The javascript is of the following form: <a class="ExcelLink" onclick="javascript:customWindowOpen(some adress, some parameters);return false;" href="javascript:void(0)">CSV</a> Commented Jun 19, 2009 at 22:03
  • The 'some address', 'some parameters' part is the important part. Either that address IS the URL for the file, or you determine it from what the content of that address is. If you use FireBug, you can simply look at your Net console and see directly where the file comes from. Commented Jun 19, 2009 at 22:10
  • You can also publish source code by skipping a line and then putting four spaces in front of it. Commented Jun 19, 2009 at 22:11
  • Tried to retrieve the file from the address in JavaScript. It returns a file with ASPX extension, but no csv file. The address is of the form blabla/blabla/ExcelExport.aspx?tbl=0&Columns=... What do I do now? What is ASPX? Commented Jun 19, 2009 at 22:46
  • It looks like the CSV file is being delivered dynamically by an ASP application. en.wikipedia.org/wiki/ASP.NET Commented Jun 19, 2009 at 23:01

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

3 Comments

Look in the source of the page for the "customWindowOpen()" function
Was this a comment meant for the original poster, maybe?
Tried to retrieve the file from the address in JavaScript. It returns a file with ASPX extension, but no csv file. The address is of the form blabla/blabla/ExcelExport.aspx?tbl=0&Columns=... What do I do now? What is ASPX?
0

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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.