Scraper Session does not finish

I have a scraping session that I am running to download an excel file.
It runs fine, and creates the file. But the scrape session never finishes.
Here are the last few lines of the scrape.

Scraping file: "Excel"
Excel: Processing scripts before a file is scraped.
Processing script: "NationStar_Download_Curr_URL"
Wrote file from: http://www.nationstarbroker.com/RateSheets/Loader.ashx?id=xxxx&of=EXCEL to file: c:\ScrapeWork\NationStar.xlsx
Excel: Preliminary URL: http://www.nationstarbroker.com/RateSheets/Loader.ashx
Excel: Using strict mode.
Excel: Resolved URL: http://www.nationstarbroker.com/RateSheets/Loader.ashx?id=xxxx&of=EXCEL
Excel: Sending request.

Scott, I will e-mail you the sss.

Thanks
Bart

Thanks.

That did it.

Bart, So, the problem is that

Bart,

So, the problem is that you have a script which is calling scrapeableFile.getCurrentURL in order to get the URL to pass to session.downloadFile. You are calling your script from a scrapeable file whose URL is the same you are using to download your file.

Two things wrong with this.

  1. Calling scrapeableFile.getCurrentURL from a scrapeable file before a file is scraped will strip off any session variables prior to returning the value of the current URL.
  2. session.downloadFile is not meant to be called from a scrapeable file with the same URL as the file you are wanting to download. Instead, it is meant to be called, say, from an extractor pattern which is attempting to match on a value found in the target URL.

So, I recommend that you...

  • Note the complete URL of the "Excel" scrapeable file.
  • Remove the "Excel" scrapeable file.
  • Modify your download script to say this
  • currentURL = "http://www.nationstarbroker.com/RateSheets/Loader.ashx?id=" + dataRecord.get("FILEID") + "&of=EXCEL";
    session.downloadFile(currentURL, session.getVariable("DOWNLOAD_PATH"));

  • Call your script "After each pattern match" of the "Get File Name" extractor pattern in the "Fees" scrapeable file

I apologize for the confusion with how to use session.downloadFile. I added a note to the documentation that will hopefully make this more clear.

I hope this helps.
-Scott