1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "runMode": "DEVELOPMENT",
12 "startUrls": [
13 {
14 "url": "https://crawlee.dev/js"
15 }
16 ],
17 "respectRobotsTxtFile": true,
18 "linkSelector": "a[href]",
19 "globs": [
20 {
21 "glob": "https://crawlee.dev/js/*/*"
22 }
23 ],
24 "pseudoUrls": [],
25 "excludes": [
26 {
27 "glob": "/**/*.{png,jpg,jpeg,pdf}"
28 }
29 ],
30 "proxyConfiguration": {
31 "useApifyProxy": true
32 },
33 "initialCookies": [],
34 "waitUntil": [
35 "networkidle2"
36 ],
37 "preNavigationHooks": `// We need to return array of (possibly async) functions here.
38 // The functions accept two arguments: the "crawlingContext" object
39 // and "gotoOptions".
40 [
41 async (crawlingContext, gotoOptions) => {
42 // ...
43 },
44 ]`,
45 "postNavigationHooks": `// We need to return array of (possibly async) functions here.
46 // The functions accept a single argument: the "crawlingContext" object.
47 [
48 async (crawlingContext) => {
49 // ...
50 },
51 ]`,
52 "breakpointLocation": "NONE",
53 "customData": {}
54};
55
56
57const run = await client.actor("vertivine/opentable-review-scraper").call(input);
58
59
60console.log('Results from dataset');
61console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
62const { items } = await client.dataset(run.defaultDatasetId).listItems();
63items.forEach((item) => {
64 console.dir(item);
65});
66
67