Image exist or not, after data sraping from ecom site

studio
datascraping
image

#1

Hi,

I am extracting the data from an ecom site using Data scraping.

The scrapped data includes Image, title, price and owner.

After extracting, I am writing that using Write CSV.
I have to write True/False in CSV if an image exist/Doesn’t exist in the site for a corresponding product.

can someone help out how to perform that check and write the result in CSV?

Thanks,
Sudhakar


#2

Before you write the CSV - add a data column called ImageExists. Then loop through the file with the logic…

If row("image") is null  -- note I'm not sure how image is represented in the datatable
then assign row("ImageExists") = false else true 

Hope that gets you started. Assign is quite useful for setting values.

RD


#3

Thanks Richard !
Got your logic.
But, when data scrapping an image i could only see empty row in data table. It does not retrieve any detail regarding that image.
If we had got anything out of data scrape we could have manipulated something with whatever scrapped. But it was not the case.

Regards,
Sudhakar


#4

Use the Extract URL property when you select the image elements. Then you can check if URL is empty or not.


#5

Hi Silviu,

Thanks for the suggestion.

I just have attached the sample search result.
There we could see that, there are some valid image for an advertisement and couple of other ad has no valid image(Instead it has an image stating NO PHOTO).

Now if we go by the way you have suggested, it would still give us an URL since it has an image there.(Not an expected one though). This is where i would like to differentiate the thumbnails as True/False.

Regards,
Sudhakar A.S


#6

Probably all the “No photo” images have the same url and this is different than the urls of valid images. Use this to differentiate between a “No photo” image and a valid image.

IF (url = url_of_no_photo) validThumbnails = false
Else validThumbnails = true