
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.
page-scraper
Advanced tools
Web page scraper with a jQuery-like syntax for Node. Powered by got and cheerio.
$ npm install page-scraper
const scrape = require('page-scraper');
(async () => {
const $ = await scrape('https://example.com');
// Extract the page with jQuery like syntax.
console.log({
title: $('title').text(),
heading: $('h1').text(),
paragraphs: $('p').map((index, el) => $(el).text()).get(),
link: $('p > a').attr('href')
});
})();
Check the cheerio documentation for a complete guide on how to scrape the page using jQuery like syntax.
const scrape = require('page-scraper');
(async () => {
try {
const $ = await scrape('https://httpbin.org/status/400');
} catch(error) {
// The error message.
console.error(error.message);
if (error.hasOwnProperty('response')) {
// The HTTP status code.
console.error(error.response.statusCode);
}
if (error.hasOwnProperty('$')) {
// The HTML document.
console.error(error.$.html());
}
}
})();
Note that if the page is not an HTML document, it will throw an error too.
const scrape = require('./src');
(async () => {
try {
const $ = await scrape('https://httpbin.org/json');
} catch(error) {
console.error(error.message);
if (error.hasOwnProperty('response')) {
// The response body.
console.error(error.response.body);
}
}
})();
const scrape = require('./src');
(async () => {
const $ = await Promise.all([
scrape('https://example.com'),
scrape('https://httpbin.org/html')
]);
console.log({
heading_1: $[0]('h1').text(),
heading_2: $[1]('h1').text()
});
})();
FAQs
Web page scraper with a jQuery-like syntax for Node.
We found that page-scraper 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.