1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "businesses": [
12 {
13 "title": "Example Consulting",
14 "website": "https://example.com/",
15 "categoryName": "Consultant",
16 "phone": "+1 555 0100",
17 "address": "1 Example Way, Springfield",
18 "totalScore": 4.6,
19 "reviewsCount": 41,
20 "placeId": "sample-1"
21 },
22 {
23 "title": "Joe's Plumbing",
24 "categoryName": "Plumber",
25 "phone": "+27 21 555 0101",
26 "address": "12 Long St, Cape Town",
27 "totalScore": 4.9,
28 "reviewsCount": 6,
29 "placeId": "sample-2"
30 },
31 {
32 "title": "Nails by Thandi",
33 "website": "https://www.facebook.com/nailsbythandi",
34 "categoryName": "Nail salon",
35 "totalScore": 3.8,
36 "reviewsCount": 22,
37 "placeId": "sample-3"
38 },
39 {
40 "title": "Expired Cert Bakery",
41 "website": "https://expired.badssl.com/",
42 "categoryName": "Bakery",
43 "totalScore": 4.4,
44 "reviewsCount": 88,
45 "placeId": "sample-4"
46 },
47 {
48 "title": "Ghost Domain Garage",
49 "website": "https://lead-qualifier-test-does-not-exist.co.za/",
50 "categoryName": "Auto repair shop",
51 "placeId": "sample-5"
52 },
53 {
54 "title": "HTTP Only Hardware",
55 "website": "http://httpforever.com/",
56 "categoryName": "Hardware store",
57 "totalScore": 4.1,
58 "reviewsCount": 15,
59 "placeId": "sample-6"
60 },
61 {
62 "title": "Old Town Physics Tutors",
63 "website": "http://info.cern.ch/",
64 "categoryName": "Tutoring service",
65 "totalScore": 4.7,
66 "reviewsCount": 12,
67 "placeId": "sample-7"
68 }
69 ],
70 "urls": [
71 "https://httpbin.org/status/403",
72 "https://www.google.com/lead-qualifier-missing-page",
73 "wordpress.org",
74 "https://www.python.org",
75 "https://www.example.com/contact"
76 ]
77};
78
79
80const run = await client.actor("crawlem/lead-qualifier").call(input);
81
82
83console.log('Results from dataset');
84console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
85const { items } = await client.dataset(run.defaultDatasetId).listItems();
86items.forEach((item) => {
87 console.dir(item);
88});
89
90