'Scrapy Get Image Xpath

I try to get image url from here _https://kirpich-s.ru/catalog/kirpich-ruchnoj-formovki-seriya-standart/1 and use this code:

response.xpath('/html/body/div[2]/div/div/div/div/div[1]/div/div/div/div/div[1]/a/img/@src').get()

But it doesn't work. I think that my xpath is wrong but I get it trought chrome console. Could you tell is problem with xpath or with code?



Solution 1:[1]

Use this xpath to identify.

//img[contains(@src,'foto/brick-handmade')]/@src

code:

response.xpath("//img[contains(@src,'foto/brick-handmade')]/@src").get()

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 KunduK