-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot handle div elements nested within <a> tags #4186
Comments
return |
This is how HTML works. Try using htmlparser2 to parse (eg. using the options |
cheerio code:
`function parseHtml(html: string): Element[] {
const $ = cheerio.load(html);
console.log($.html())
function extractElement($el: cheerio.Cheerio): Element {
const tag = $el.prop('tagName').toLowerCase();
const attributes = $el.attr() || {};
}
const rootElement = $('body').children().first();
return [extractElement(rootElement)];
}`
Want a tag child element that can be extracted hierarchically.
The text was updated successfully, but these errors were encountered: