Replacing a Variable in the URL field of a Scrapeable file
In the URL field of a scrapeable file I have the following hypothetical value
I want this variable "QUOTE" to be replaced with a value when I invoke " Run Scraping Session".
This is what I unsuccessfully did.
Created a script with the following code.
session.setVariable( "QUOTE","GOOG" );
And I attached it to the scrapeable file then I set "When to run" to "Before file is scraped".
Unfortunately "QUOTE" is not replaced with "GOOG".
Therefore causing a 404.
What am I doing wrong? Your help is welcome.
Thanks.
Replacing a Variable in the URL field of a Scrapeable file
Tirap,
Though we spoke on the phone about this I'll go ahead and answer you here for the benefit of others.
The thing to keep in mind is that you're wanting to reference the variable QUOTE.
To [i]reference[/i] a session variable use this convention:
http://yahoo.com/~#QUOTE#~
Whereas, to [i]set[/i] the variable as a token in an extractor pattern text area you use:
http://yahoo.com/~@QUOTE@~
And, yes, you could have the entire URL be a variable that you, say, read in to screen-scraper from a list of URL's in, say, a CSV file.
-Scott