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 "(Sony OR \"WH-1000XM5\" OR \"WH-1000XM6\") (headphones OR earbuds) lang:en -filter:nativeretweets"
13 ],
14 "maxItems": 1000,
15 "analysis": {
16 "targets": [
17 {
18 "name": "Sony",
19 "aliases": [
20 "Sony headphones",
21 "WH-1000XM5",
22 "WH-1000XM6"
23 ]
24 }
25 ],
26 "context": "Consumer headphones & customer service."
27 },
28 "monitor": {
29 "maxBaselineRows": 100000
30 },
31 "queryType": "Latest + Top",
32 "includeSearchTerms": true
33};
34
35
36const run = await client.actor("xquik/x-twitter-brand-monitoring").call(input);
37
38
39console.log('Results from dataset');
40console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
41const { items } = await client.dataset(run.defaultDatasetId).listItems();
42items.forEach((item) => {
43 console.dir(item);
44});
45
46