1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "usernames": [
12 "zuck",
13 "kyliejenner"
14 ],
15 "user_initial_cursor": "QVFCS29wWUlIczJWNTBh",
16 "thread_codes": [
17 "DP8XomBDhqt"
18 ],
19 "thread_initial_cursor": "QVFCS29wWUlIczJWNTBh",
20 "search_enabled": true,
21 "search_queries": [
22 "openai",
23 "instagram threads"
24 ],
25 "search_query": "openai",
26 "search_from": "TechCrunch",
27 "search_before": "2025-01-01",
28 "search_after": "2025-01-01",
29 "search_initial_cursor": "QVFCS29wWUlIczJWNTBh"
30};
31
32
33const run = await client.actor("igview-owner/threads-scraper-pro").call(input);
34
35
36console.log('Results from dataset');
37console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
38const { items } = await client.dataset(run.defaultDatasetId).listItems();
39items.forEach((item) => {
40 console.dir(item);
41});
42
43