Reputation: 97
How can I get the value 5000+ by providing key "Installs" to xpath.
<div class="hAyfc">
<div class="BgcNfc">Installs</div>
<span class="htlgb">
<div><span class="htlgb">5,000+</span></div>
</span>
</div>
I tried this response.xpath('//span/div/span/text()').extract() but it's giving all text.
Can anyone help me with it?
Upvotes: 1
Views: 660
Reputation: 818
I tried this and it worked:
response.xpath('//div[./div/text()="Installs"]/span/div/span/text()').extract_first()
It searches for a div
with a div
child that has the text()="Installs"
, then searches for the span
containing the value you requested.
Upvotes: 2
Reputation: 2357
Try this:
response.xpath('./div/span[@class="htlgb"]/text()').extract()
Upvotes: 0