How to extract the value of an HTML attribute using scrapy response.xpath? How to extract the value of an HTML attribute using scrapy response.xpath? shell shell

How to extract the value of an HTML attribute using scrapy response.xpath?


I just wanted to post the answer I found.

To get the 22.63 value our of the data-asin-price attribute in scrapy shell I did the following:

response.xpath('//div[@id = "cerberus-data-metrics"]/@data-asin-price').extract_first()

Cheers