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 "company": "Acme Robotics",
14 "website": "https://www.acme-robotics.example/?utm_source=newsletter",
15 "country": "DE",
16 "employees": 120,
17 "industry": "Robotics"
18 },
19 {
20 "company": "ACME Robotics GmbH",
21 "website": "acme-robotics.example",
22 "country": "DE",
23 "employees": 120,
24 "industry": "Robotics"
25 },
26 {
27 "company": "Bluefin Analytics",
28 "website": "https://bluefin-analytics.example/about",
29 "country": "GB",
30 "employees": 45,
31 "industry": "Software"
32 },
33 {
34 "company": "Cedar & Stone Builders",
35 "website": "http://cedarstone.example",
36 "country": "US",
37 "employees": 8,
38 "industry": "Construction"
39 },
40 {
41 "company": "Delta Freight Partners",
42 "website": "https://www.deltafreight.example/contact/",
43 "country": "NL",
44 "employees": 310,
45 "industry": "Logistics"
46 },
47 {
48 "company": "Bluefin Analytics Ltd",
49 "website": "https://BLUEFIN-ANALYTICS.example/?utm_campaign=q3",
50 "country": "GB",
51 "employees": 47,
52 "industry": "Software"
53 },
54 {
55 "company": "Evergreen Solar Co",
56 "website": "https://evergreen-solar.example",
57 "country": "ES",
58 "employees": 64,
59 "industry": "Energy"
60 },
61 {
62 "company": "Fjord Bio",
63 "website": "https://fjordbio.example/en/",
64 "country": "NO",
65 "employees": 5,
66 "industry": "Biotech"
67 },
68 {
69 "company": "Granite Data Systems",
70 "website": "https://granitedata.example/?utm_medium=cpc&page=2",
71 "country": "US",
72 "employees": 1500,
73 "industry": "Software"
74 },
75 {
76 "company": "Harbor Lane Coffee",
77 "website": "",
78 "country": "US",
79 "employees": 22,
80 "industry": "Food"
81 },
82 {
83 "company": "Delta Freight Partners B.V.",
84 "website": "deltafreight.example",
85 "country": "NL",
86 "employees": 305,
87 "industry": "Logistics"
88 }
89 ],
90 "normalizeUrlFields": [
91 "website"
92 ],
93 "extractDomainFrom": "website",
94 "filters": [
95 {
96 "field": "employees",
97 "op": "gte",
98 "value": 10
99 }
100 ],
101 "dedupeFields": [
102 "domain"
103 ],
104 "sortBy": "employees",
105 "sortDirection": "desc",
106 "exportFormats": [
107 "csv"
108 ]
109};
110
111
112const run = await client.actor("saliga/dataset-merge-dedupe").call(input);
113
114
115console.log('Results from dataset');
116console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
117const { items } = await client.dataset(run.defaultDatasetId).listItems();
118items.forEach((item) => {
119 console.dir(item);
120});
121
122