SidGabriel
SidGabriel

Reputation: 185

Scrapy / How to select data directly nested into span

One website I am trying to scrap has a specific structure for prices. It is something like :

<span class="sale-price" data-sup-product-price="" data-item-price="2.02" ...>
2,
<sup>02 E</sup>
</span>

It is possible to access directly the data-item-price data nested into the span ?

I mean, not something like :

response.css("span.sale-price").extract()

But another way with data-item-price ?

Upvotes: 1

Views: 142

Answers (1)

vezunchik
vezunchik

Reputation: 3717

Try response.css("span.sale-price::attr(data-item-price)").get() for getting data from this field. Or if you want to get all span with such field use selector span[data-item-price].

Upvotes: 2

Related Questions