Referencing results in extractor patterns

I'm trying to scrape one page, extract the data then use the result to search a second page and search for data next to the result from the first.

e.g.

Page 1 -

Alpha
Beta
Gamma

Page 2 -

Here is some random text Beta here is the data

To do this I've got a scrape file for each page and I can successfully extract Beta from page 1 (and hold it in TOKEN) but I'm having a problem trying to match the desired data using

~#TOKEN#~ ~@NEW_TOKEN@~

The log says I have no matches when I try to use ~@TOKEN@~ (the extractor pattern works on static data).

Is it possible to reference data this way within extractor patterns (I already reference the data in parameters).

Referencing results in extractor patterns

Alan,

I am an employee here at screen-scraper and he wanted me to reply to your post. It may not be the optimal solution but what I would do is:

1) create a general extractor pattern for the first page to catch the names of each show.
2) after each pattern application scrape the name of each show on the second page under a different token name and the description as something like ~@DESC@~.
3) on the second page after each pattern application, with a script compare the first show name to the second show name with if(show1.equals(show2)). When they do match then save the ~@DESC@~ variable as the actual description variable you want to keep.

This requires a lot of page calls but I am pretty sure it would get the job done.

Bryan

Call script from another script

Bryan,

Thanks for this, it's working well for the the data extraction but I've just got one more question. How do I call a script file from within another script?

I've tried

session.script( "My Export to File Script" );

and

session.scrapeFile( "My Export to File Script" );

but both throw errors. Do you have an online API where I can look this sort of info up rather than bothering you?

Alex

Referencing results in extractor patterns

Scott,

Is it possible to combine scrape files? Is this a native feature of SS (I've only got the pro edition) or does it need to be done as part of a script?

I'm trying to scrape a list page

http://www.nationaltheatre.org.uk/?lid=4099

but as the details pages are not that consistent, rather than trying to get the detail from them I'm trying to get a short show summary from

http://www.nationaltheatre.org.uk/?lid=171

but I'm not sure how to call the second page and try to match the data. The URL of the details page acts as a primary key.

Alex

Referencing results in extractor patterns

Alan,

At one time it was possible but it is no longer. Referencing variables within an extractor pattern text area using ~##~ is invalid. You'll need to use a different approach.

Try combining your scrapeable files when possible and using sub-extractor patterns and the special ~@DATARECORD@~ token.

http://community.screen-scraper.com/extractor_patterns

-Scott