Answer the question
In order to leave comments, you need to log in
How to parse only 1 tag out of many?
Good afternoon. I'm trying to parse a page using cheerio. Everything is fine, but there is a lot of text on the page in p tags and their classes are also the same. How can I get the contents of the first p tag only?
needle.get(url, function(err, response) {
const data = response.body
const $ = cheerio.load(data)
var descr = $('article section div div p').text();
console.log(descr)
})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question