1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "keywords": [
12 "chatgpt",
13 "gemini",
14 "claude ai"
15 ],
16 "compareKeywords": true,
17 "geo": "",
18 "geos": [],
19 "customRange": "",
20 "category": 0,
21 "maxRelated": 25,
22 "trendingGeos": [
23 "US"
24 ],
25 "language": "en-US",
26 "stateName": "",
27 "maxReports": 500,
28 "maxTrendingTerms": 500
29};
30
31
32const run = await client.actor("vonsensey/google-trends-compare-keywords-scraper-api").call(input);
33
34
35console.log('Results from dataset');
36console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
37const { items } = await client.dataset(run.defaultDatasetId).listItems();
38items.forEach((item) => {
39 console.dir(item);
40});
41
42