JSDOM Scraper avatar

JSDOM Scraper

Try for free

No credit card required

Go to Store
JSDOM Scraper

JSDOM Scraper

apify/jsdom-scraper
Try for free

No credit card required

Parses the HTML using the JSDOM library, providing the same DOM API as browsers do (e.g. `window`). It is able to process client-side JavaScript without using a real browser. Performance-wise, it stands somewhere between the Cheerio Scraper and the browser scrapers.

Do you want to learn more about this Actor?

Get a demo

You can access the JSDOM Scraper programmatically from your own applications by using the Apify API. You can choose the language preference from below. To use the Apify API, you’ll need an Apify account and your API token, found in Integrations settings in Apify Console.

1echo '{
2  "startUrls": [
3    {
4      "url": "https://crawlee.dev"
5    }
6  ],
7  "globs": [
8    {
9      "glob": "https://crawlee.dev/*/*"
10    }
11  ],
12  "pseudoUrls": [],
13  "excludes": [
14    {
15      "glob": "/**/*.{png,jpg,jpeg,pdf}"
16    }
17  ],
18  "linkSelector": "a[href]",
19  "pageFunction": "async function pageFunction(context) {\\n    const { window, request, log } = context;\\n\\n    // The \\"window\\" property contains the JSDOM object which is useful\\n    // for querying DOM elements and extracting data from them.\\n    const pageTitle = window.document.title;\\n\\n    // The \\"request\\" property contains various information about the web page loaded. \\n    const url = request.url;\\n    \\n    // Use \\"log\\" object to print information to actor log.\\n    log.info('\''Page scraped'\'', { url, pageTitle });\\n\\n    // Return an object with the data extracted from the page.\\n    // It will be stored to the resulting dataset.\\n    return {\\n        url,\\n        pageTitle\\n    };\\n}",
20  "proxyConfiguration": {
21    "useApifyProxy": true
22  },
23  "initialCookies": [],
24  "additionalMimeTypes": [],
25  "preNavigationHooks": "// We need to return array of (possibly async) functions here.\\n// The functions accept two arguments: the \\"crawlingContext\\" object\\n// and \\"requestAsBrowserOptions\\" which are passed to the `requestAsBrowser()`\\n// function the crawler calls to navigate..\\n[\\n    async (crawlingContext, requestAsBrowserOptions) => {\\n        // ...\\n    }\\n]",
26  "postNavigationHooks": "// We need to return array of (possibly async) functions here.\\n// The functions accept a single argument: the \\"crawlingContext\\" object.\\n[\\n    async (crawlingContext) => {\\n        // ...\\n    },\\n]",
27  "customData": {}
28}' |
29apify call apify/jsdom-scraper --silent --output-dataset

JSDOM Scraper API through CLI

The Apify CLI is the official tool that allows you to use JSDOM Scraper locally, providing convenience functions and automatic retries on errors.

Install the Apify CLI

1npm i -g apify-cli
2apify login

Other API clients include:

Developer
Maintained by Apify

Actor Metrics

  • 3 monthly users

  • 4 stars

  • 0% runs succeeded

  • Created in Dec 2022

  • Modified 5 months ago