parse5
parse5 is a Node.js library for parsing and manipulating HTML and XML documents. It is designed to be fast and flexible, and it is commonly used in web scraping and web development projects.
parse5 is used by popular libraries such as Angular, Lit, Cheerio and many more. Unlike Cheerio parse5 is a low level html parsing library that might be useful directly in web scraping without higher level abstraction.
Example Use
```javascript const parse5 = require("parse5");
// parse string const document = parse5.parse('
Hello World!'); console.log(document);// html tree can be traversed as javascript object: const body = document.childNodes[1]; console.log(body.childNodes[0].value); // "Hello World!"
// and modified const newElement = parse5.parseFragment('
New Element
'); body.appendChild(newElement.childNodes[0]); console.log(parse5.serialize(document)); ```Alternatives / Similar
jsdom
new