When crawling a web page, we obtained below data.
<div id="productDetails">
<span>MacBook Air 13"</span>
<span>$999</span>
</div>
Using cheerio
, we need to take the content of second span. Here is how:
$("#productDetails span:nth-child(2)").text();