Reputation: 69
<div class="container">
<span class="price">
<bdi> 140 </bdi>
</span>
<span class="price">
<del>
<bdi>90</bdi>
</del>
<ins>
<bdi> 120 </bdi>
</ins>
</span>
</div>
I want to scrape a site which html formatting like below. Here I dont want to bdi tag value which is under del tag and want bdi tag value which is under span class and ins tag. Is there any path to figure it out?
Upvotes: 0
Views: 123
Reputation: 1445
Don't pretty much usual //span/ins/bdi/text()
work for you?
This is "text of <bdi>
which parent is <ins>
which parent is <span>
"?
CSS variant span>ins>bdi::text
should also work I suppose.
Sorry, haven't noticed that you need two values. In that case .xpath('//bdi[not(parent::del)]/text()').extract()
will work well.
Upvotes: 1