1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "rows": [
12 {
13 "name": "Python Software Foundation",
14 "website": "https://www.python.org/",
15 "city": "Beaverton",
16 "source": "maps run 1"
17 },
18 {
19 "name": "Mozilla",
20 "website": "https://www.mozilla.org/en-US/",
21 "city": "San Francisco",
22 "source": "maps run 1"
23 },
24 {
25 "name": "Wikimedia Foundation",
26 "website": "https://wikimediafoundation.org",
27 "city": "San Francisco",
28 "source": "maps run 1"
29 },
30 {
31 "name": "Python Software Foundation ",
32 "website": "python.org",
33 "city": "Beaverton",
34 "source": "maps run 2"
35 },
36 {
37 "name": "Mozilla Foundation",
38 "website": "http://mozilla.org/en-US?utm_source=maps",
39 "city": "San Francisco",
40 "source": "maps run 2"
41 },
42 {
43 "name": "Apache Software Foundation",
44 "website": "https://www.apache.org/",
45 "city": "Wilmington",
46 "source": "maps run 2"
47 },
48 {
49 "name": "No website listed",
50 "website": "",
51 "city": "Unknown",
52 "source": "maps run 2"
53 }
54 ],
55 "dedupeBy": [
56 "website"
57 ]
58};
59
60
61const run = await client.actor("stellalytics/dataset-merge-dedupe").call(input);
62
63
64console.log('Results from dataset');
65console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
66const { items } = await client.dataset(run.defaultDatasetId).listItems();
67items.forEach((item) => {
68 console.dir(item);
69});
70
71