0.2.14 • Published 7 years ago

html-cruncher v0.2.14

Weekly downloads
7
License
MIT
Repository
github
Last release
7 years ago

html-cruncher

Build Status

html-cruncher is a light-weight, dependency-free package for parsing HTML documents. It was born out of the necessity to have an easy interface for finding certain elements in a page's DOM.

Usage

Start out by installing html-cruncher using npm:

npm install html-cruncher

Set up your node project to use the html-cruncher:

var request = require("request");
var HTMLElement = require("html-cruncher");

request("http://www.google.com", function(err, response, body) {
	var document = HTMLElement.fromString(body);
})

Features

Once you've gotten a parsed DOM, you can search against it using the same methods that you'd typically use in browser-side JavaScript.

  • getElementById
  • getElementsByClassName
  • getElementsByTagName

There's also a small subset of XPath available through the xpath method on HTMLElement. You can select elements in a DOM by providing some simple xpath commands:

  • Element selection, direct child and full DOM.
  • Predicates
    • Select node at index.
    • Only select text nodes.
    • Attribute equality.

More will be added as needs arise, but for now, this is all that's needed all uses of this package I've been informed of.

0.2.14

7 years ago

0.2.13

7 years ago

0.2.12

7 years ago

0.2.11

7 years ago

0.2.10

7 years ago

0.2.9

8 years ago

0.2.8

8 years ago

0.2.7

8 years ago

0.2.6

8 years ago

0.2.5

8 years ago

0.2.4

8 years ago

0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago