Given the following code, cheerio only lists one child node which is an <img src="" /> tag. The nearest h2 tag is about 49 elements away. If I lognHTML without calling html() it lists a ton more elements in the DOMObject.
How can I get cheerio to work correctly?
const $ = cheerio.load(html);
        let nHTML = $('#'+slug).nextUntil('h2');
        nHTML = nHTML.html();
PS, I am unable to post the exact HTML that I'm pulling in. I have verified that h2 tags are only for headings.
via Quesofat
 
No comments:
Post a Comment