0
votes

I am trying to import the 5 product image from the following link

https://www.zara.com/tr/en/full-length-trousers-p07385169.html?v1=88239943&v2=1471790

When I tried importing the src attribute from the following Xpath

=IMPORTXML(A1,"//img[@class='media-image__image media__wrapper--media']//@src")

It returned an image which was diffrent from the product image, Although it is not the same image that is shown in the inspect element target in chrome.

I found this class that has the 5 images in a row seperated by coma

//ul[@class="product-detail-images__images"]/li[5]//source

the problem is that this elements contains two attributes, the first one is called sizes which when scraped it returns its value normally and another attribute in which the image links are stored under media srcset which doesn't return when I try to import it using =IMPORTXML(A1,"//ul[@class="product-detail-images__images"]/li[5]//source/@media srcset" or even =IMPORTXML(A1,"//ul[@class='product-detail-images__images']/li[5]//source/@*")this returns only the first attribute!

My target is to import all the product images from the page. is there is any fixes that I must make to my import statement, or any other method to import the images using importxml.

Deep Thanks In Advance

1
FYI it’s scraped not scrapped. Scrapped means thrown away like rubbish - balmy

1 Answers

1
votes

Upon checking, it seems that the content of the website you are trying to fetch is being controlled by JavaScript. Thus, making it not possible for Google Sheet to scrape it using IMPORT functions.

You can check if a website is scrapeable using IMPORT functions by turning JavaScript to 'Block'(Click lock icon beside address bar -> site settings -> set JavaScript to 'Block') and see if the content you are trying to fetch still appear on the reloaded website.

Please see screenshot of the website after doing the steps above.

enter image description here