1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "startUrls": [
12 {
13 "url": "https://docs.apify.com/academy/web-scraping-for-beginners"
14 }
15 ],
16 "useSitemaps": false,
17 "respectRobotsTxtFile": true,
18 "crawlerType": "playwright:adaptive",
19 "includeUrlGlobs": [],
20 "excludeUrlGlobs": [],
21 "initialCookies": [],
22 "proxyConfiguration": {
23 "useApifyProxy": true
24 },
25 "keepElementsCssSelector": "",
26 "removeElementsCssSelector": `nav, footer, script, style, noscript, svg, img[src^='data:'],
27 [role="alert"],
28 [role="banner"],
29 [role="dialog"],
30 [role="alertdialog"],
31 [role="region"][aria-label*="skip" i],
32 [aria-modal="true"]`,
33 "blockMedia": true,
34 "clickElementsCssSelector": "[aria-expanded=\"false\"]"
35};
36
37
38const run = await client.actor("apify/website-content-crawler").call(input);
39
40
41console.log('Results from dataset');
42console.log(`๐พ Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
43const { items } = await client.dataset(run.defaultDatasetId).listItems();
44items.forEach((item) => {
45 console.dir(item);
46});
47
48