1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "results": [
12 {
13 "keyword": "best running shoes",
14 "rank": 1,
15 "url": "https://nike.com/running-shoes",
16 "title": "Best Running Shoes | Nike"
17 },
18 {
19 "keyword": "best running shoes",
20 "rank": 2,
21 "url": "https://adidas.com/running",
22 "title": "Running Shoes | adidas"
23 },
24 {
25 "keyword": "best running shoes",
26 "rank": 3,
27 "url": "https://runnersworld.com/gear/best-running-shoes",
28 "title": "The Best Running Shoes, Tested - Runner's World"
29 },
30 {
31 "keyword": "marathon training plan",
32 "rank": 1,
33 "url": "https://adidas.com/training/marathon",
34 "title": "Marathon Training Plan | adidas"
35 },
36 {
37 "keyword": "marathon training plan",
38 "rank": 2,
39 "url": "https://runnersworld.com/training/marathon-plan",
40 "title": "Marathon Training Plan - Runner's World"
41 },
42 {
43 "keyword": "marathon training plan",
44 "rank": 3,
45 "url": "https://nike.com/marathon",
46 "title": "Marathon Guide | Nike"
47 }
48 ],
49 "brandMap": {
50 "Nike": [
51 "nike.com"
52 ],
53 "adidas": [
54 "adidas.com"
55 ],
56 "Runner's World": [
57 "runnersworld.com"
58 ]
59 },
60 "yourBrand": "Nike"
61};
62
63
64const run = await client.actor("that_red_bird/serp-share-of-voice").call(input);
65
66
67console.log('Results from dataset');
68console.log(`๐พ Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
69const { items } = await client.dataset(run.defaultDatasetId).listItems();
70items.forEach((item) => {
71 console.dir(item);
72});
73
74