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 "(\"can anyone recommend\" OR \"any recommendations for\" OR \"need help with\" OR \"how do I fix\") (laptop OR phone OR headphones) lang:en -filter:nativeretweets"
13 ],
14 "maxItems": 1000,
15 "analysis": {
16 "questions": [
17 {
18 "id": "request",
19 "type": "choice",
20 "version": "1",
21 "instructions": "What does the author ask for?",
22 "categories": {
23 "support": "Help with a problem.",
24 "recommendation": "Advice on choosing a product.",
25 "other": "Neither request."
26 }
27 }
28 ],
29 "targets": [],
30 "context": "",
31 "maxContextBytes": 12000,
32 "concurrency": 16
33 },
34 "monitor": {
35 "maxBaselineRows": 100000
36 },
37 "queryType": "Latest + Top",
38 "includeSearchTerms": true
39};
40
41
42const run = await client.actor("xquik/x-twitter-tweet-classifier").call(input);
43
44
45console.log('Results from dataset');
46console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
47const { items } = await client.dataset(run.defaultDatasetId).listItems();
48items.forEach((item) => {
49 console.dir(item);
50});
51
52