
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
dom-extractor
Advanced tools
A remote HTML page DOM extractor. Extracts what you want from a remote page or a string, using selectors. Based on request for fetching, cheerios for parsing, cssom for checking css rules and juice for inlining css.
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.
npm install dom-extractor
var extractor = require('dom-extractor');
extractor.fetch("http://github.com/", "div.header", function(data){
//data contains the extracted HTML with css inlined, here the github header
});
var extractor = require('dom-extractor');
extractor.fetch("<div class='a'>Hello</div><div class='b'>World</div>!", ".a", function(data){
//should contains the div with class a
});
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.
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 = require('dom-extractor');
extractor.fetch("http://github.com/", { selector: "div.header", innerText: true }, function(data){
//data contains the extracted HTML with css inlined, here the github header
});
app.use('/proxy', extractor.middleware());
npm install
npm install -g jshint
npm test
FAQs
A remote HTML page DOM extractor. Extracts what you want from a remote page or a string, using selectors. Based on request for fetching, cheerios for parsing, cssom for checking css rules and juice for inlining css.
The npm package dom-extractor receives a total of 18 weekly downloads. As such, dom-extractor popularity was classified as not popular.
We found that dom-extractor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.