Megos
Megos

Reputation: 25

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?

Upvotes: 0

Views: 71

Answers (1)

KunduK
KunduK

Reputation: 33384

Use this xpath to identify.

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

code:

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

Upvotes: 1

Related Questions