List variable refuse to save
Good evening scrapers.
I'm working on a setup to scrape a pretty large XML file which for each object has a number of images. I used the following script when trying to add those images to a common variable IMAGE_LIST before inserting the values. All seem to work well but the IMAGE_LIST variable keeps coming out with null values. Am I missing something here:
import com.screenscraper.common.*;
// Extract images from datarecord
DataSet Images = scrapeableFile.extractData(dataRecord.get("DATARECORD"), "Single foto");
// Iterate
session.log("-------------------------------------------------");
session.log("~~~Found " + Images.getNumDataRecords() + " images");
session.log("-------------------------------------------------");
for (i=0; i
I see a few problems.
I see a few problems. Compare to this:
import com.screenscraper.common.*;
// Extract images from datarecord
DataSet Images = scrapeableFile.extractData(dataRecord.get("DATARECORD"), "Single foto");
photos = session.getVariable("IMAGE_LIST");
if (photos == null)
photos = "";
// Iterate
session.log("-------------------------------------------------");
session.log("~~~Found " + Images.getNumDataRecords() + " images");
session.log("-------------------------------------------------");
for (i=0; i
{
singleImage = Images.getDataRecord(i);
imageName = singleImage.get("IMAGE");
photos += imageName + "|";
session.setVariable("IMAGE_LIST", photos);
// Check if variable has value
session.log("-------------------------------------------------");
session.log("~~~Adding foto " + imageName );
session.log("-------------------------------------------------");
session.breakpoint();
}
Works fine now. Much
Works fine now.
Much appreciated Jason!