htmlparser2 / 3.7.3 last updated 8 months ago created on Aug 28th 2011
Install
npm install --save htmlparser2
Clone
git clone git@github.com:fb55/htmlparser2.git
dependencies
show all 9
| main |
|
domhandler | 2.2.0 | BSD 2-Clause |
|
|
domutils | 1.5.0 | BSD 2-Clause | |
|
|
domelementtype | 1.1.1 | BSD 2-Clause | |
|
|
readable-stream | 1.1.13-1 | MIT | |
|
|
entities | 1.0.0 | BSD-like |
maintainers
versions
47 total
| 3.7.3 | 8 months ago | feedic |
| 3.7.2 | 10 months ago | feedic |
| 3.7.1 | a year ago | feedic |
| 3.7.0 | a year ago | feedic |
| 3.6.0 | a year ago | feedic |
| 3.5.1 | a year ago | feedic |
| 3.5.0 | a year ago | feedic |
| 3.4.0 | a year ago | feedic |
| 3.3.0 | 2 years ago | feedic |
| 3.2.5 | 2 years ago | feedic |
| 3.2.4 | 2 years ago | feedic |
| 3.2.3 | 2 years ago | feedic |
| 3.2.2 | 2 years ago | feedic |
| 3.2.1 | 2 years ago | feedic |
| 3.2.0 | 2 years ago | feedic |
| 3.1.6 | 2 years ago | feedic |
| 3.1.5 | 2 years ago | feedic |
| 3.1.4 | 2 years ago | feedic |
| 3.1.3 | 2 years ago | feedic |
| 3.1.2 | 2 years ago | feedic |
| 3.1.1 | 2 years ago | feedic |
| 3.0.5 | 2 years ago | feedic |
| 3.0.4 | 2 years ago | feedic |
| 3.0.3 | 2 years ago | feedic |
| 3.0.2 | 2 years ago | feedic |
| 3.0.1 | 2 years ago | feedic |
| 3.0.0 | 2 years ago | feedic |
| 2.6.0 | 2 years ago | feedic |
| 2.5.2 | 2 years ago | feedic |
| 2.5.1 | 2 years ago | feedic |
| 2.5.0 | 2 years ago | feedic |
| 2.2.9 | 3 years ago | feedic |
| 2.2.8 | 3 years ago | feedic |
| 2.2.7 | 3 years ago | feedic |
| 2.2.6 | 3 years ago | feedic |
| 2.2.5 | 3 years ago | feedic |
| 2.2.4 | 3 years ago | feedic |
| 2.2.3 | 3 years ago | feedic |
| 2.2.2 | 3 years ago | feedic |
| 2.2.0 | 3 years ago | feedic |
| 2.1.3 | 3 years ago | feedic |
| 2.1.2 | 3 years ago | feedic |
| 2.1.1 | 3 years ago | feedic |
| 2.1.0 | 3 years ago | feedic |
| 2.0.1 | 3 years ago | feedic |
| 2.0.0 | 3 years ago | feedic |
| 1.5.0 | 3 years ago | feedic |
readme
htmlparser2
A forgiving HTML/XML/RSS parser written in JS for NodeJS. The parser can handle streams (chunked data) and supports custom handlers for writing custom DOMs/output.
Installing
A live demo of htmlparser2 is available at http://demos.forbeslindesay.co.uk/htmlparser2/
Usage
Output (simplified):
Read more about the parser in the wiki.
Get a DOM
The DomHandler (known as DefaultHandler in the original htmlparser module) produces a DOM (document object model) that can be manipulated using the DomUtils helper.
The DomHandler, while still bundled with this module, was moved to its own module. Have a look at it for further information.
Parsing RSS/RDF/Atom Feeds
Performance
After having some artificial benchmarks for some time, @AndreasMadsen published his htmlparser-benchmark, which benchmarks HTML parses based on real-world websites.
At the time of writing, the latest versions of all supported parsers show the following performance characteristics on Travis CI (please note that Travis doesn't guarantee equal conditions for all tests):
How is this different from node-htmlparser?
This is a fork of the htmlparser module. The main difference is that this is intended to be used only with node (it runs on other platforms using browserify). htmlparser2 was rewritten multiple times and, while it maintains an API that's compatible with htmlparser in most cases, the projects don't share any code anymore.
The parser now provides a callback interface close to sax.js (originally targeted at readabilitySAX). As a result, old handlers won't work anymore.
The DefaultHandler and the RssHandler were renamed to clarify their purpose (to DomHandler and FeedHandler). The old names are still available when requiring htmlparser2, so your code should work as expected.