1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "maxDiscoveryChargeUsd": 0.5,
12 "sourceMode": "list",
13 "itemsList": [
14 {
15 "shortcode": "rA1x2Y3z4",
16 "post_url": "https://www.instagram.com/p/rA1x2Y3z4/",
17 "type": "Video",
18 "product_type": "clips",
19 "caption": "Why does your espresso taste sour? ☕\nIt's almost never the beans — it's your grind. Here's the 10-second fix.\nSave this for your next shot.",
20 "hashtags": [
21 "espresso",
22 "coffeetips",
23 "homebarista",
24 "coffeelover"
25 ],
26 "like_count": 3100,
27 "comment_count": 210,
28 "view_count": 41200,
29 "date": "2026-09-26T08:15:00+00:00",
30 "user": {
31 "username": "demo_roastery",
32 "full_name": "Demo Roastery",
33 "is_verified": false
34 },
35 "from_url": "https://www.instagram.com/demo_roastery/",
36 "comments_disabled": false
37 },
38 {
39 "shortcode": "rB2y3Z4a5",
40 "post_url": "https://www.instagram.com/p/rB2y3Z4a5/",
41 "type": "Sidecar",
42 "product_type": "carousel_container",
43 "caption": "5 brew ratios every home barista should know\nSwipe through, then try number 3 tomorrow morning.",
44 "hashtags": [
45 "brewing",
46 "coffeetips",
47 "homebarista"
48 ],
49 "like_count": 1150,
50 "comment_count": 100,
51 "view_count": null,
52 "date": "2026-09-22T17:40:00+00:00",
53 "user": {
54 "username": "demo_roastery",
55 "full_name": "Demo Roastery",
56 "is_verified": false
57 },
58 "from_url": "https://www.instagram.com/demo_roastery/",
59 "carousel_media_count": 5,
60 "comments_disabled": false
61 },
62 {
63 "shortcode": "rC3z4A5b6",
64 "post_url": "https://www.instagram.com/p/rC3z4A5b6/",
65 "type": "Image",
66 "product_type": "feed",
67 "caption": "New single origin just landed: Ethiopia Guji, notes of peach and jasmine.",
68 "hashtags": [
69 "singleorigin",
70 "coffee"
71 ],
72 "like_count": 395,
73 "comment_count": 25,
74 "view_count": null,
75 "date": "2026-09-18T09:05:00+00:00",
76 "user": {
77 "username": "demo_roastery",
78 "full_name": "Demo Roastery",
79 "is_verified": false
80 },
81 "from_url": "https://www.instagram.com/demo_roastery/",
82 "comments_disabled": false
83 },
84 {
85 "shortcode": "rD4a5B6c7",
86 "post_url": "https://www.instagram.com/p/rD4a5B6c7/",
87 "type": "Image",
88 "product_type": "feed",
89 "caption": "Saturday at the roastery. Come say hi until 4 pm.",
90 "hashtags": [
91 "roastery",
92 "coffee"
93 ],
94 "like_count": 440,
95 "comment_count": 30,
96 "view_count": null,
97 "date": "2026-09-13T11:20:00+00:00",
98 "user": {
99 "username": "demo_roastery",
100 "full_name": "Demo Roastery",
101 "is_verified": false
102 },
103 "from_url": "https://www.instagram.com/demo_roastery/",
104 "comments_disabled": false
105 },
106 {
107 "shortcode": "rE5b6C7d8",
108 "post_url": "https://www.instagram.com/p/rE5b6C7d8/",
109 "type": "Video",
110 "product_type": "clips",
111 "caption": "Behind the scenes: roast day.",
112 "hashtags": [
113 "roasting",
114 "coffee"
115 ],
116 "like_count": 460,
117 "comment_count": 35,
118 "view_count": 7800,
119 "date": "2026-09-09T14:00:00+00:00",
120 "user": {
121 "username": "demo_roastery",
122 "full_name": "Demo Roastery",
123 "is_verified": false
124 },
125 "from_url": "https://www.instagram.com/demo_roastery/",
126 "comments_disabled": false
127 },
128 {
129 "shortcode": "rF6c7D8e9",
130 "post_url": "https://www.instagram.com/p/rF6c7D8e9/",
131 "type": "Image",
132 "product_type": "feed",
133 "caption": "Our autumn blend is back.",
134 "hashtags": [
135 "autumn",
136 "coffee"
137 ],
138 "like_count": 420,
139 "comment_count": 45,
140 "view_count": null,
141 "date": "2026-09-04T10:30:00+00:00",
142 "user": {
143 "username": "demo_roastery",
144 "full_name": "Demo Roastery",
145 "is_verified": false
146 },
147 "from_url": "https://www.instagram.com/demo_roastery/",
148 "comments_disabled": false
149 },
150 {
151 "shortcode": "fA1x2Y3z4",
152 "post_url": "https://www.instagram.com/p/fA1x2Y3z4/",
153 "type": "Video",
154 "product_type": "clips",
155 "caption": "How to do your first pull-up in 4 weeks 💪\nNo gym needed — just a door frame and a towel.\nComment PULL and I'll send you the plan.",
156 "hashtags": [
157 "pullup",
158 "calisthenics",
159 "homeworkout",
160 "fitnessmotivation",
161 "strength"
162 ],
163 "like_count": 2650,
164 "comment_count": 480,
165 "view_count": 63000,
166 "date": "2026-09-25T06:45:00+00:00",
167 "user": {
168 "username": "demo_fitcoach",
169 "full_name": "Demo Fit Coach",
170 "is_verified": false
171 },
172 "from_url": "https://www.instagram.com/demo_fitcoach/",
173 "comments_disabled": false
174 },
175 {
176 "shortcode": "fB2y3Z4a5",
177 "post_url": "https://www.instagram.com/p/fB2y3Z4a5/",
178 "type": "Sidecar",
179 "product_type": "carousel_container",
180 "caption": "3 mistakes that keep your squat stuck at the same weight\nMistake #2 surprised most of my clients.",
181 "hashtags": [
182 "squat",
183 "strengthtraining",
184 "gymtips"
185 ],
186 "like_count": 1020,
187 "comment_count": 90,
188 "view_count": null,
189 "date": "2026-09-20T18:10:00+00:00",
190 "user": {
191 "username": "demo_fitcoach",
192 "full_name": "Demo Fit Coach",
193 "is_verified": false
194 },
195 "from_url": "https://www.instagram.com/demo_fitcoach/",
196 "carousel_media_count": 5,
197 "comments_disabled": false
198 },
199 {
200 "shortcode": "fC3z4A5b6",
201 "post_url": "https://www.instagram.com/p/fC3z4A5b6/",
202 "type": "Image",
203 "product_type": "feed",
204 "caption": "Meal prep Sunday. Chicken, rice, greens.",
205 "hashtags": [
206 "mealprep",
207 "fitfood"
208 ],
209 "like_count": 330,
210 "comment_count": 20,
211 "view_count": null,
212 "date": "2026-09-15T12:00:00+00:00",
213 "user": {
214 "username": "demo_fitcoach",
215 "full_name": "Demo Fit Coach",
216 "is_verified": false
217 },
218 "from_url": "https://www.instagram.com/demo_fitcoach/",
219 "comments_disabled": false
220 },
221 {
222 "shortcode": "fD4a5B6c7",
223 "post_url": "https://www.instagram.com/p/fD4a5B6c7/",
224 "type": "Video",
225 "product_type": "clips",
226 "caption": "Quick mobility flow before work.",
227 "hashtags": [
228 "mobility",
229 "stretching"
230 ],
231 "like_count": 360,
232 "comment_count": 40,
233 "view_count": 5200,
234 "date": "2026-09-11T07:30:00+00:00",
235 "user": {
236 "username": "demo_fitcoach",
237 "full_name": "Demo Fit Coach",
238 "is_verified": false
239 },
240 "from_url": "https://www.instagram.com/demo_fitcoach/",
241 "comments_disabled": false
242 },
243 {
244 "shortcode": "fE5b6C7d8",
245 "post_url": "https://www.instagram.com/p/fE5b6C7d8/",
246 "type": "Image",
247 "product_type": "feed",
248 "caption": "Client win of the week — 12 weeks, one big smile.",
249 "hashtags": [
250 "clientwin",
251 "transformation"
252 ],
253 "like_count": 390,
254 "comment_count": 30,
255 "view_count": null,
256 "date": "2026-09-07T16:20:00+00:00",
257 "user": {
258 "username": "demo_fitcoach",
259 "full_name": "Demo Fit Coach",
260 "is_verified": false
261 },
262 "from_url": "https://www.instagram.com/demo_fitcoach/",
263 "comments_disabled": false
264 },
265 {
266 "shortcode": "fF6c7D8e9",
267 "post_url": "https://www.instagram.com/p/fF6c7D8e9/",
268 "type": "Image",
269 "product_type": "feed",
270 "caption": "Rest day reminder: recovery is training too.",
271 "hashtags": [
272 "recovery",
273 "restday"
274 ],
275 "like_count": 340,
276 "comment_count": 25,
277 "view_count": null,
278 "date": "2026-09-02T09:00:00+00:00",
279 "user": {
280 "username": "demo_fitcoach",
281 "full_name": "Demo Fit Coach",
282 "is_verified": false
283 },
284 "from_url": "https://www.instagram.com/demo_fitcoach/",
285 "comments_disabled": false
286 },
287 {
288 "shortcode": "sA1x2Y3z4",
289 "post_url": "https://www.instagram.com/p/sA1x2Y3z4/",
290 "type": "Image",
291 "product_type": "feed",
292 "caption": "Stop layering five serums. Here's what a dermatologist-reviewed routine actually looks like.\nSave this before your next skincare haul.",
293 "hashtags": [
294 "skincare",
295 "skincareroutine",
296 "glowup",
297 "serum",
298 "skintok",
299 "beautytips",
300 "dermatology",
301 "cleanbeauty"
302 ],
303 "like_count": 2250,
304 "comment_count": 310,
305 "view_count": null,
306 "date": "2026-09-24T13:25:00+00:00",
307 "user": {
308 "username": "demo_skinlab",
309 "full_name": "Demo Skin Lab",
310 "is_verified": false
311 },
312 "from_url": "https://www.instagram.com/demo_skinlab/",
313 "comments_disabled": false
314 },
315 {
316 "shortcode": "sB2y3Z4a5",
317 "post_url": "https://www.instagram.com/p/sB2y3Z4a5/",
318 "type": "Video",
319 "product_type": "clips",
320 "caption": "3 ingredients that don't mix 🚫\nNumber 2 is in half your bathroom cabinets.",
321 "hashtags": [
322 "skincare",
323 "ingredients",
324 "skincaretips"
325 ],
326 "like_count": 1180,
327 "comment_count": 140,
328 "view_count": 28900,
329 "date": "2026-09-19T19:00:00+00:00",
330 "user": {
331 "username": "demo_skinlab",
332 "full_name": "Demo Skin Lab",
333 "is_verified": false
334 },
335 "from_url": "https://www.instagram.com/demo_skinlab/",
336 "comments_disabled": false
337 },
338 {
339 "shortcode": "sC3z4A5b6",
340 "post_url": "https://www.instagram.com/p/sC3z4A5b6/",
341 "type": "Image",
342 "product_type": "feed",
343 "caption": "New: barrier repair cream, now in a larger jar.",
344 "hashtags": [
345 "newlaunch",
346 "skincare"
347 ],
348 "like_count": 410,
349 "comment_count": 30,
350 "view_count": null,
351 "date": "2026-09-16T10:10:00+00:00",
352 "user": {
353 "username": "demo_skinlab",
354 "full_name": "Demo Skin Lab",
355 "is_verified": false
356 },
357 "from_url": "https://www.instagram.com/demo_skinlab/",
358 "comments_disabled": false
359 },
360 {
361 "shortcode": "sD4a5B6c7",
362 "post_url": "https://www.instagram.com/p/sD4a5B6c7/",
363 "type": "Image",
364 "product_type": "feed",
365 "caption": "Behind the lab: where we test every batch.",
366 "hashtags": [
367 "behindthescenes",
368 "lab"
369 ],
370 "like_count": 380,
371 "comment_count": 35,
372 "view_count": null,
373 "date": "2026-09-10T12:45:00+00:00",
374 "user": {
375 "username": "demo_skinlab",
376 "full_name": "Demo Skin Lab",
377 "is_verified": false
378 },
379 "from_url": "https://www.instagram.com/demo_skinlab/",
380 "comments_disabled": false
381 },
382 {
383 "shortcode": "sE5b6C7d8",
384 "post_url": "https://www.instagram.com/p/sE5b6C7d8/",
385 "type": "Sidecar",
386 "product_type": "carousel_container",
387 "caption": "Ingredient glossary, part one.",
388 "hashtags": [
389 "ingredients",
390 "skincare"
391 ],
392 "like_count": 430,
393 "comment_count": 25,
394 "view_count": null,
395 "date": "2026-09-06T15:00:00+00:00",
396 "user": {
397 "username": "demo_skinlab",
398 "full_name": "Demo Skin Lab",
399 "is_verified": false
400 },
401 "from_url": "https://www.instagram.com/demo_skinlab/",
402 "carousel_media_count": 5,
403 "comments_disabled": false
404 },
405 {
406 "shortcode": "sF6c7D8e9",
407 "post_url": "https://www.instagram.com/p/sF6c7D8e9/",
408 "type": "Image",
409 "product_type": "feed",
410 "caption": "Weekend sale: 15% off the starter set.",
411 "hashtags": [
412 "sale",
413 "skincare"
414 ],
415 "like_count": 365,
416 "comment_count": 20,
417 "view_count": null,
418 "date": "2026-09-01T08:00:00+00:00",
419 "user": {
420 "username": "demo_skinlab",
421 "full_name": "Demo Skin Lab",
422 "is_verified": false
423 },
424 "from_url": "https://www.instagram.com/demo_skinlab/",
425 "comments_disabled": false
426 }
427 ],
428 "discoveryInput": {}
429};
430
431
432const run = await client.actor("rich_minds/ig-competitor-winning-posts").call(input);
433
434
435console.log('Results from dataset');
436console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
437const { items } = await client.dataset(run.defaultDatasetId).listItems();
438items.forEach((item) => {
439 console.dir(item);
440});
441
442