node-dom-extractor
A node package used to extract a DOM element from a remote page or a string, using selectors. Based on jsdom for fetching and parsing, and juice for inlining css.
Install
npm install dom-extractor
Extract DOM from a remote URL
var extractor = ;extractor;
Extract DOM from a string
var extractor = ;extractor;
Note about # selector
When you use # as a selector, the browser do not send the data since it is a keyword for anchoring things in page, browser side.
To use it anyway, use |sharp| as the selector.
Using options
You can use options as the second parameter. List of current options are:
selector: String //set the selector for extraction default is body innerText: Boolean //get text only from extraction, no html or css default is false inlineCss: Boolean //Put style in style attributes of extracted dom default is true
Example, using div.header selector and getting text only from result:
var extractor = ;extractor;
Use it as a middleware (Connect)
app;
Running tests
npm install
npm install -g jshint
npm test