1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "searchTerms": ["(\"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"],
10 "maxItems": 1000,
11 "analysis": {
12 "questions": [{
13 "id": "request",
14 "type": "choice",
15 "version": "1",
16 "instructions": "What does the author ask for?",
17 "categories": {
18 "support": "Help with a problem.",
19 "recommendation": "Advice on choosing a product.",
20 "other": "Neither request.",
21 },
22 }],
23 "targets": [],
24 "context": "",
25 "maxContextBytes": 12000,
26 "concurrency": 16,
27 },
28 "monitor": { "maxBaselineRows": 100000 },
29 "queryType": "Latest + Top",
30 "includeSearchTerms": True,
31}
32
33
34run = client.actor("xquik/x-twitter-tweet-classifier").call(run_input=run_input)
35
36
37print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
38for item in client.dataset(run.default_dataset_id).iterate_items():
39 print(item)
40
41