1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "comparisonId": "sample-serp",
12 "query": "apify actors",
13 "engine": "google",
14 "locale": "en-US",
15 "device": "desktop",
16 "baseline": [
17 {
18 "rank": 1,
19 "url": "https://example.com/guide",
20 "title": "Actor Guide"
21 },
22 {
23 "rank": 2,
24 "url": "https://example.org/store",
25 "title": "Actor Store"
26 }
27 ],
28 "current": [
29 {
30 "rank": 1,
31 "url": "https://example.org/store",
32 "title": "Actor Store"
33 },
34 {
35 "rank": 3,
36 "url": "https://example.com/guide",
37 "title": "Actor Guide"
38 }
39 ]
40};
41
42
43const run = await client.actor("ceddl/serp-rank-change-detector").call(input);
44
45
46console.log('Results from dataset');
47console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
48const { items } = await client.dataset(run.defaultDatasetId).listItems();
49items.forEach((item) => {
50 console.dir(item);
51});
52
53