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 "https://www.local.ch/en/q?what=Restaurant&where=Zurich"
13 ],
14 "searches": [
15 {
16 "what": "Restaurant",
17 "where": "Zurich"
18 },
19 {
20 "what": "Dentist",
21 "where": "Geneva"
22 }
23 ],
24 "what": "Restaurant",
25 "where": "Zurich",
26 "maxResults": 20,
27 "maxPagesPerSearch": 3,
28 "language": "en",
29 "maxRequestRetries": 3
30};
31
32
33const run = await client.actor("automation-lab/local-ch-business-directory-scraper").call(input);
34
35
36console.log('Results from dataset');
37console.log(`πΎ Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
38const { items } = await client.dataset(run.defaultDatasetId).listItems();
39items.forEach((item) => {
40 console.dir(item);
41});
42
43