Closed masylum closed 5 months ago
This allows customizing the parser (using htmlparser2 instead of default's more strict and slower parse5). Also, if you do any post-processing, you can reuse the object and avoid parsing twice (expensive)
Thanks for this!
Whe you pass htmlDom keep in mind you should to also take care about the url for resolving relative URLs:
htmlDom
const { load } = require('cheerio') const htmlDom = load(html, { baseURI: url })
This allows customizing the parser (using htmlparser2 instead of default's more strict and slower parse5). Also, if you do any post-processing, you can reuse the object and avoid parsing twice (expensive)