1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "rawData": [
10 {
11 "company": "Northwind Traders",
12 "website": "https://www.northwind.example/?utm_source=directory",
13 "email": "Sales@Northwind.example",
14 "phone": "(415) 555-2671",
15 "city": "San Francisco",
16 },
17 {
18 "company": "Northwind Traders Inc.",
19 "website": "http://northwind.example/",
20 "email": "sales@northwind.example",
21 "phone": "+1 415 555 2671",
22 "employees": 120,
23 },
24 {
25 "company": "Contoso Ltd",
26 "website": "https://contoso.example/about",
27 "phone": "212-555-0187",
28 "city": "New York",
29 },
30 {
31 "company": "Contoso",
32 "website": "https://www.contoso.example/about/#team",
33 "email": "hello@contoso.example",
34 "city": "",
35 },
36 {
37 "company": "Fabrikam",
38 "website": "https://fabrikam.example",
39 "email": "info@fabrikam.example",
40 "city": "Austin",
41 },
42 {
43 "company": "Tailspin Toys",
44 "website": "https://tailspin.example/shop?gclid=abc123",
45 "city": "Denver",
46 },
47 {
48 "company": "Tailspin Toys",
49 "website": "https://tailspin.example/shop",
50 "phone": "720 555 0144",
51 "city": "Denver",
52 },
53 ],
54 "dedupeFields": ["website"],
55 "urlFields": ["website"],
56 "keep": "merge",
57}
58
59
60run = client.actor("fernandosord/dataset-merge-dedupe").call(run_input=run_input)
61
62
63print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
64for item in client.dataset(run.default_dataset_id).iterate_items():
65 print(item)
66
67