1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "searchTerms": [
12 "bitcoin",
13 "ethereum"
14 ],
15 "geo": "US",
16 "timeframe": "today 12-m",
17 "dataTypes": [
18 "interestOverTime",
19 "interestByRegion",
20 "relatedQueries"
21 ],
22 "maxItems": 1000,
23 "compareKeywords": false,
24 "splitCommas": false,
25 "searchType": "web",
26 "regionLevel": "default",
27 "category": 0,
28 "language": "en-US"
29};
30
31
32const run = await client.actor("dami_studio/google-trends-scraper").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