Vanilla JS Scraper
No credit card required
Vanilla JS Scraper
No credit card required
Scrape the web using familiar JavaScript methods! Crawls websites using raw HTTP requests, parses the HTML with the JSDOM package, and extracts data from the pages using Node.js code. Supports both recursive crawling and lists of URLs. This actor is a non jQuery alternative to CheerioScraper.
You can access the Vanilla JS 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 "requests": [
3 {
4 "url": "https://apify.com"
5 }
6 ],
7 "pseudoUrls": [
8 {
9 "purl": "https://apify.com[(/[\\\\w-]+)?]"
10 }
11 ],
12 "linkSelector": "a[href]",
13 "pageFunction": "async function pageFunction(context) {\\n const { window, document, crawler, enqueueRequest, request, response, userData, json, body, kvStore, customData } = context;\\n\\n const title = document.querySelector('\''title'\'').textContent\\n\\n const responseHeaders = response.headers\\n\\n return {\\n title,\\n responseHeaders\\n };\\n}",
14 "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]",
15 "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]",
16 "proxy": {
17 "useApifyProxy": true
18 },
19 "additionalMimeTypes": [],
20 "customData": {}
21}' |
22apify call mstephen190/vanilla-js-scraper --silent --output-dataset
Vanilla JS Scraper API through CLI
The Apify CLI is the official tool that allows you to use Vanilla JS 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:
- 11 monthly users
- 3 stars
- 99.3% runs succeeded
- Created in Mar 2022
- Modified about 1 year ago