ultra-igdl 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +727 -594
- package/dist/cli/index.cjs +1 -1
- package/dist/cli/index.cjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +91 -90
package/README.md
CHANGED
|
@@ -1,594 +1,727 @@
|
|
|
1
|
-
# ultra-igdl
|
|
2
|
-
|
|
3
|
-
**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
###
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
###
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
|
264
|
-
|
|
265
|
-
| `
|
|
266
|
-
| `
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
```
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
```
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
|
471
|
-
|
|
472
|
-
|
|
|
473
|
-
|
|
|
474
|
-
|
|
475
|
-
|
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
|
481
|
-
|
|
482
|
-
|
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
1
|
+
# ultra-igdl
|
|
2
|
+
|
|
3
|
+
**Beginner-friendly Instagram media extractor for Node.js**
|
|
4
|
+
|
|
5
|
+
Get direct download links (images and videos) from Instagram posts, reels, carousels, stories, and highlights. Use it from the **command line** or inside your **JavaScript / TypeScript** app.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/ultra-igdl)
|
|
8
|
+
|
|
9
|
+
**Links:** [npm package](https://www.npmjs.com/package/ultra-igdl) · [GitHub](https://github.com/WH173-5P1D3R/ultra-igdl) · [Report issues](https://github.com/WH173-5P1D3R/ultra-igdl/issues)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Table of contents
|
|
14
|
+
|
|
15
|
+
1. [What does this do?](#1-what-does-this-do)
|
|
16
|
+
2. [Who is this for?](#2-who-is-this-for)
|
|
17
|
+
3. [Before you start (requirements)](#3-before-you-start-requirements)
|
|
18
|
+
4. [Install Node.js and the package](#4-install-nodejs-and-the-package)
|
|
19
|
+
5. [Your first download (CLI)](#5-your-first-download-cli)
|
|
20
|
+
6. [Your first download (code)](#6-your-first-download-code)
|
|
21
|
+
7. [Understanding the JSON response](#7-understanding-the-json-response)
|
|
22
|
+
8. [Instagram session — why and how](#8-instagram-session--why-and-how)
|
|
23
|
+
9. [Content types (posts, reels, carousels, stories)](#9-content-types-posts-reels-carousels-stories)
|
|
24
|
+
10. [Command line (CLI) — full guide](#10-command-line-cli--full-guide)
|
|
25
|
+
11. [JavaScript / TypeScript API](#11-javascript--typescript-api)
|
|
26
|
+
12. [Configuration options](#12-configuration-options)
|
|
27
|
+
13. [Batch URLs and bots](#13-batch-urls-and-bots)
|
|
28
|
+
14. [Error codes and fixes](#14-error-codes-and-fixes)
|
|
29
|
+
15. [FAQ and troubleshooting](#15-faq-and-troubleshooting)
|
|
30
|
+
16. [Examples in this repository](#16-examples-in-this-repository)
|
|
31
|
+
17. [Legal and privacy](#17-legal-and-privacy)
|
|
32
|
+
18. [License](#18-license)
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 1. What does this do?
|
|
37
|
+
|
|
38
|
+
You give **ultra-igdl** an Instagram link. It returns:
|
|
39
|
+
|
|
40
|
+
- **Direct media URLs** (CDN links you can open or save)
|
|
41
|
+
- **Caption** and **username**
|
|
42
|
+
- Optional **likes / comments** counts when Instagram shows them
|
|
43
|
+
- Hints in `tags` (for example: carousel detected, session recommended)
|
|
44
|
+
|
|
45
|
+
It works **without logging in** for many public posts and reels, but Instagram limits logged-out access. For **full carousels**, **reel video files**, **stories**, and **highlights**, you usually need a **browser session cookie** (explained in [section 8](#8-instagram-session--why-and-how)).
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 2. Who is this for?
|
|
50
|
+
|
|
51
|
+
| You are… | Start here |
|
|
52
|
+
|----------|------------|
|
|
53
|
+
| **Complete beginner** | [Section 4](#4-install-nodejs-and-the-package) → [Section 5](#5-your-first-download-cli) (CLI with `npx`) |
|
|
54
|
+
| **JavaScript developer** | [Section 6](#6-your-first-download-code) → [Section 11](#11-javascript--typescript-api) |
|
|
55
|
+
| **Bot builder** (Telegram, Discord, etc.) | [Section 8](#8-instagram-session--why-and-how) + [Section 13](#13-batch-urls-and-bots) |
|
|
56
|
+
| **TypeScript user** | [Section 11](#11-javascript--typescript-api) (types included) |
|
|
57
|
+
|
|
58
|
+
No Instagram API key is required. You only need Node.js and a valid Instagram URL.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 3. Before you start (requirements)
|
|
63
|
+
|
|
64
|
+
| Requirement | Details |
|
|
65
|
+
|-------------|---------|
|
|
66
|
+
| **Node.js** | Version **20.18.1 or newer** (22 LTS is fine). Check with `node -v` |
|
|
67
|
+
| **npm** | Comes with Node. Check with `npm -v` |
|
|
68
|
+
| **Instagram URL** | A normal link you can open in a browser (post, reel, story, etc.) |
|
|
69
|
+
| **Session cookie** | Optional but strongly recommended for carousels, reel MP4, stories |
|
|
70
|
+
|
|
71
|
+
**Check Node version:**
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
node -v
|
|
75
|
+
# Should print v20.18.1 or higher (e.g. v22.x.x)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
If Node is too old, install the latest LTS from [https://nodejs.org](https://nodejs.org).
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 4. Install Node.js and the package
|
|
83
|
+
|
|
84
|
+
### Option A — Use without installing (fastest try)
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
npx ultra-igdl --help
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
`npx` downloads the tool temporarily and runs it. Good for a quick test.
|
|
91
|
+
|
|
92
|
+
### Option B — Add to your project (recommended for apps)
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
mkdir my-ig-downloader
|
|
96
|
+
cd my-ig-downloader
|
|
97
|
+
npm init -y
|
|
98
|
+
npm install ultra-igdl
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
You can then `import` or `require` it in your code (see [section 6](#6-your-first-download-code)).
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## 5. Your first download (CLI)
|
|
106
|
+
|
|
107
|
+
### Step 1 — Copy an Instagram URL
|
|
108
|
+
|
|
109
|
+
Example (replace with a real public post):
|
|
110
|
+
|
|
111
|
+
```text
|
|
112
|
+
https://www.instagram.com/p/SHORTCODE/
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Step 2 — Run the CLI
|
|
116
|
+
|
|
117
|
+
**Linux / macOS / Git Bash:**
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
npx ultra-igdl "https://www.instagram.com/p/SHORTCODE/"
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Windows PowerShell** — always put the URL in **double quotes**:
|
|
124
|
+
|
|
125
|
+
```powershell
|
|
126
|
+
npx ultra-igdl "https://www.instagram.com/p/SHORTCODE/"
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Step 3 — Read the output
|
|
130
|
+
|
|
131
|
+
Without `--json`, you get a short summary: username, caption preview, and a list of media items with type and URL.
|
|
132
|
+
|
|
133
|
+
For **machine-readable output** (scripts, bots):
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
npx ultra-igdl "https://www.instagram.com/p/SHORTCODE/" --json
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Step 4 — Save files to disk
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
npx ultra-igdl "https://www.instagram.com/p/SHORTCODE/" --download --output ./downloads
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Files go under `./downloads/<username>/`.
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## 6. Your first download (code)
|
|
150
|
+
|
|
151
|
+
Create a file `test.mjs` in your project folder (after `npm install ultra-igdl`).
|
|
152
|
+
|
|
153
|
+
### ESM (modern Node — `"type": "module"` in package.json, or `.mjs` file)
|
|
154
|
+
|
|
155
|
+
```js
|
|
156
|
+
import { ultraigdl } from "ultra-igdl";
|
|
157
|
+
|
|
158
|
+
const ig = new ultraigdl();
|
|
159
|
+
const url = "https://www.instagram.com/reel/SHORTCODE/";
|
|
160
|
+
|
|
161
|
+
const result = await ig.download(url);
|
|
162
|
+
|
|
163
|
+
if (result.code === 200) {
|
|
164
|
+
console.log("Creator:", result.username);
|
|
165
|
+
console.log("Caption:", result.caption);
|
|
166
|
+
console.log("Number of files:", result.media.length);
|
|
167
|
+
for (const item of result.media) {
|
|
168
|
+
console.log(item.type, item.url);
|
|
169
|
+
}
|
|
170
|
+
} else {
|
|
171
|
+
console.log("Failed:", result.code, result.message);
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Run:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
node test.mjs
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### CommonJS (`.cjs` file or no `"type": "module"`)
|
|
182
|
+
|
|
183
|
+
```js
|
|
184
|
+
const { ultraigdl } = require("ultra-igdl");
|
|
185
|
+
|
|
186
|
+
(async () => {
|
|
187
|
+
const ig = new ultraigdl();
|
|
188
|
+
const result = await ig.download("https://www.instagram.com/p/SHORTCODE/");
|
|
189
|
+
console.log(JSON.stringify(result, null, 2));
|
|
190
|
+
})();
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Handle success vs error (important pattern)
|
|
194
|
+
|
|
195
|
+
Every call returns an object with a **`code`** field:
|
|
196
|
+
|
|
197
|
+
- **`200`** — success; use `media`, `caption`, `username`
|
|
198
|
+
- **Anything else** — error; read `message`
|
|
199
|
+
|
|
200
|
+
```js
|
|
201
|
+
const result = await ig.download(url);
|
|
202
|
+
if (result.code !== 200) {
|
|
203
|
+
throw new Error(`${result.code}: ${result.message}`);
|
|
204
|
+
}
|
|
205
|
+
// TypeScript: narrow with if (result.code === 200) { ... result.media }
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## 7. Understanding the JSON response
|
|
211
|
+
|
|
212
|
+
### Successful response (`code: 200`)
|
|
213
|
+
|
|
214
|
+
```json
|
|
215
|
+
{
|
|
216
|
+
"code": 200,
|
|
217
|
+
"meta": {
|
|
218
|
+
"extractor": "ultra-igdl",
|
|
219
|
+
"version": "1.0.2"
|
|
220
|
+
},
|
|
221
|
+
"username": "creator",
|
|
222
|
+
"caption": "Post caption as one clean line",
|
|
223
|
+
"media": [
|
|
224
|
+
{
|
|
225
|
+
"type": "image",
|
|
226
|
+
"url": "https://...cdninstagram.com/....jpg",
|
|
227
|
+
"width": 1440,
|
|
228
|
+
"height": 1800
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"type": "video",
|
|
232
|
+
"url": "https://...mp4",
|
|
233
|
+
"thumbnail": "https://...jpg",
|
|
234
|
+
"width": 1080,
|
|
235
|
+
"height": 1920,
|
|
236
|
+
"duration": 24
|
|
237
|
+
}
|
|
238
|
+
],
|
|
239
|
+
"engagement": {
|
|
240
|
+
"likes": 1200,
|
|
241
|
+
"comments": 45
|
|
242
|
+
},
|
|
243
|
+
"tags": ["carousel"]
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Media object fields
|
|
248
|
+
|
|
249
|
+
| Field | Meaning |
|
|
250
|
+
|-------|---------|
|
|
251
|
+
| `type` | `"image"` or `"video"` |
|
|
252
|
+
| `url` | Direct link to the file (use as-is; do not remove `?` parameters) |
|
|
253
|
+
| `thumbnail` | Preview image for videos |
|
|
254
|
+
| `width` / `height` | Pixel size when known |
|
|
255
|
+
| `duration` | Video length in seconds |
|
|
256
|
+
|
|
257
|
+
### Tags (`tags` array) — what they mean for you
|
|
258
|
+
|
|
259
|
+
| Tag | Meaning | What you should do |
|
|
260
|
+
|-----|---------|-------------------|
|
|
261
|
+
| `carousel` | Multi-photo post; all slides returned | Nothing — you got the full carousel |
|
|
262
|
+
| `partial_carousel` | Carousel detected but only one image returned | Add session cookies ([section 8](#8-instagram-session--why-and-how)) |
|
|
263
|
+
| `session_recommended` | Logged-in session would improve results | Add `cookies` or `sessionId` |
|
|
264
|
+
| `likes_hidden` | Creator hid like counts | Normal — not an error |
|
|
265
|
+
| `comments_hidden` | Comments hidden or disabled | Normal — not an error |
|
|
266
|
+
| `engagement_hidden` | Both hidden | Normal — not an error |
|
|
267
|
+
|
|
268
|
+
### Error response (`code` not 200)
|
|
269
|
+
|
|
270
|
+
```json
|
|
271
|
+
{
|
|
272
|
+
"code": 404,
|
|
273
|
+
"message": "Media not found",
|
|
274
|
+
"meta": { "extractor": "ultra-igdl", "version": "1.0.1" }
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Some responses include `retryAfterMs` when using fast-response mode ([section 13](#13-batch-urls-and-bots)).
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## 8. Instagram session — why and how
|
|
283
|
+
|
|
284
|
+
Instagram shows **less content** to visitors who are not logged in.
|
|
285
|
+
|
|
286
|
+
| Feature | Without session | With session (`cookies` / `sessionId`) |
|
|
287
|
+
|---------|-----------------|--------------------------------------|
|
|
288
|
+
| Single post image | Usually works | Works (often higher resolution) |
|
|
289
|
+
| **Carousel (2+ photos)** | Often **only 1 slide** | **All slides** |
|
|
290
|
+
| **Reel MP4 video** | Often thumbnail only | **Full video URL** |
|
|
291
|
+
| **Story** | Usually fails or preview only | **Works** (if story is still live) |
|
|
292
|
+
| **Highlight** | Limited | More reliable |
|
|
293
|
+
|
|
294
|
+
### How to get cookies (Chrome / Edge / Firefox)
|
|
295
|
+
|
|
296
|
+
1. Open [https://www.instagram.com](https://www.instagram.com) and **log in**.
|
|
297
|
+
2. Press **F12** to open Developer Tools.
|
|
298
|
+
3. Go to **Application** (Chrome) or **Storage** (Firefox) → **Cookies** → `https://www.instagram.com`.
|
|
299
|
+
4. Copy these values:
|
|
300
|
+
- `sessionid`
|
|
301
|
+
- `csrftoken`
|
|
302
|
+
- `ds_user_id`
|
|
303
|
+
|
|
304
|
+
**Treat these like a password.** Never post them on GitHub, Discord, or screenshots.
|
|
305
|
+
|
|
306
|
+
### Use in code — full cookie string (recommended)
|
|
307
|
+
|
|
308
|
+
```js
|
|
309
|
+
const ig = new ultraigdl({
|
|
310
|
+
cookies:
|
|
311
|
+
"sessionid=YOUR_SESSIONID; csrftoken=YOUR_CSRF; ds_user_id=YOUR_USER_ID",
|
|
312
|
+
});
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### Use in code — session id only
|
|
316
|
+
|
|
317
|
+
```js
|
|
318
|
+
const ig = new ultraigdl({
|
|
319
|
+
sessionId: "YOUR_SESSIONID_VALUE",
|
|
320
|
+
});
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
### Use with environment variables (CLI and scripts)
|
|
324
|
+
|
|
325
|
+
Create a `.env` file in your project folder (add `.env` to `.gitignore`):
|
|
326
|
+
|
|
327
|
+
```env
|
|
328
|
+
INSTAGRAM_COOKIES=sessionid=xxx; csrftoken=xxx; ds_user_id=xxx
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
Or only:
|
|
332
|
+
|
|
333
|
+
```env
|
|
334
|
+
INSTAGRAM_SESSION_ID=your_sessionid_value
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
The CLI loads `.env` from the current directory automatically.
|
|
338
|
+
|
|
339
|
+
**Linux / macOS terminal:**
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
export INSTAGRAM_COOKIES="sessionid=...; csrftoken=...; ds_user_id=..."
|
|
343
|
+
npx ultra-igdl "https://www.instagram.com/p/SHORTCODE/" --json
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
**Windows PowerShell** — use **two lines** (or semicolon before `npx`):
|
|
347
|
+
|
|
348
|
+
```powershell
|
|
349
|
+
$env:INSTAGRAM_COOKIES = "sessionid=...; csrftoken=...; ds_user_id=..."
|
|
350
|
+
npx ultra-igdl "https://www.instagram.com/p/SHORTCODE/" --json
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
One-line PowerShell alternative:
|
|
354
|
+
|
|
355
|
+
```powershell
|
|
356
|
+
$env:INSTAGRAM_COOKIES = "sessionid=...; csrftoken=...; ds_user_id=..."; npx ultra-igdl "https://www.instagram.com/p/SHORTCODE/" --json
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### Load cookies from `process.env` in Node
|
|
360
|
+
|
|
361
|
+
```js
|
|
362
|
+
const ig = new ultraigdl({
|
|
363
|
+
cookies: process.env.INSTAGRAM_COOKIES,
|
|
364
|
+
});
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
---
|
|
368
|
+
|
|
369
|
+
## 9. Content types (posts, reels, carousels, stories)
|
|
370
|
+
|
|
371
|
+
### Supported URL patterns
|
|
372
|
+
|
|
373
|
+
| Type | URL pattern |
|
|
374
|
+
|------|-------------|
|
|
375
|
+
| Post | `https://www.instagram.com/p/{shortcode}/` |
|
|
376
|
+
| Reel | `https://www.instagram.com/reel/{shortcode}/` |
|
|
377
|
+
| IGTV | `https://www.instagram.com/tv/{shortcode}/` |
|
|
378
|
+
| Story | `https://www.instagram.com/stories/{username}/{storyId}/` |
|
|
379
|
+
| Highlight | `https://www.instagram.com/stories/highlights/{id}/` |
|
|
380
|
+
| Highlight share link | `https://www.instagram.com/s/{token}?story_media_id=...` |
|
|
381
|
+
|
|
382
|
+
### Single-image post
|
|
383
|
+
|
|
384
|
+
```js
|
|
385
|
+
const result = await ig.download("https://www.instagram.com/p/SHORTCODE/");
|
|
386
|
+
// result.media.length is often 1
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### Carousel (multiple photos)
|
|
390
|
+
|
|
391
|
+
Same URL as a normal post (`/p/...`). No special mode — the library detects carousels automatically.
|
|
392
|
+
|
|
393
|
+
```js
|
|
394
|
+
const ig = new ultraigdl({ cookies: process.env.INSTAGRAM_COOKIES });
|
|
395
|
+
const result = await ig.download("https://www.instagram.com/p/SHORTCODE/");
|
|
396
|
+
console.log("Slides:", result.media.length);
|
|
397
|
+
console.log("Tags:", result.tags);
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
If you see `partial_carousel` or `session_recommended`, add cookies from [section 8](#8-instagram-session--why-and-how).
|
|
401
|
+
|
|
402
|
+
### Reel (video)
|
|
403
|
+
|
|
404
|
+
```js
|
|
405
|
+
const ig = new ultraigdl({ sessionId: process.env.INSTAGRAM_SESSION_ID });
|
|
406
|
+
const result = await ig.download("https://www.instagram.com/reel/SHORTCODE/");
|
|
407
|
+
const video = result.media.find((m) => m.type === "video");
|
|
408
|
+
if (video) console.log("MP4:", video.url);
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
### Story
|
|
412
|
+
|
|
413
|
+
Requires session. The story must still be **live** (not expired after 24 hours).
|
|
414
|
+
|
|
415
|
+
```js
|
|
416
|
+
const ig = new ultraigdl({ cookies: process.env.INSTAGRAM_COOKIES });
|
|
417
|
+
const result = await ig.download(
|
|
418
|
+
"https://www.instagram.com/stories/username/1234567890123456789/"
|
|
419
|
+
);
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
### Check a URL before downloading
|
|
423
|
+
|
|
424
|
+
```js
|
|
425
|
+
const check = await ig.validate("https://www.instagram.com/p/SHORTCODE/");
|
|
426
|
+
console.log(check.valid, check.type, check.normalized);
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
Or use the exported helper:
|
|
430
|
+
|
|
431
|
+
```js
|
|
432
|
+
import { validateUrl, parseInstagramUrl, isInstagramUrl } from "ultra-igdl";
|
|
433
|
+
|
|
434
|
+
console.log(isInstagramUrl(url));
|
|
435
|
+
console.log(parseInstagramUrl(url));
|
|
436
|
+
console.log(validateUrl(url));
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
---
|
|
440
|
+
|
|
441
|
+
## 10. Command line (CLI) — full guide
|
|
442
|
+
|
|
443
|
+
### Basic usage
|
|
444
|
+
|
|
445
|
+
```bash
|
|
446
|
+
npx ultra-igdl "<instagram-url>"
|
|
447
|
+
npx ultra-igdl "<instagram-url>" --json
|
|
448
|
+
npx ultra-igdl "<instagram-url>" --download
|
|
449
|
+
npx ultra-igdl "<instagram-url>" --download --output ./my-folder
|
|
450
|
+
npx ultra-igdl "<instagram-url>" --verbose
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
### Batch file (many URLs)
|
|
454
|
+
|
|
455
|
+
Create `urls.txt` — one URL per line. Lines starting with `#` are ignored.
|
|
456
|
+
|
|
457
|
+
```text
|
|
458
|
+
https://www.instagram.com/p/ABC123/
|
|
459
|
+
https://www.instagram.com/reel/DEF456/
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
Run:
|
|
463
|
+
|
|
464
|
+
```bash
|
|
465
|
+
npx ultra-igdl urls.txt --json
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
### All CLI flags
|
|
469
|
+
|
|
470
|
+
| Flag | Short | Description |
|
|
471
|
+
|------|-------|-------------|
|
|
472
|
+
| `--json` | `-j` | Print full API JSON |
|
|
473
|
+
| `--download` | `-d` | Save media files to disk |
|
|
474
|
+
| `--output <dir>` | `-o` | Download folder (default: `./downloads`) |
|
|
475
|
+
| `--verbose` | `-v` | Debug logging |
|
|
476
|
+
| `--help` | `-h` | Show help |
|
|
477
|
+
|
|
478
|
+
### Environment variables (CLI)
|
|
479
|
+
|
|
480
|
+
| Variable | Purpose |
|
|
481
|
+
|----------|---------|
|
|
482
|
+
| `INSTAGRAM_COOKIES` | Full cookie string (`sessionid=...; csrftoken=...; ...`) |
|
|
483
|
+
| `INSTAGRAM_SESSION_ID` | Just the `sessionid` value |
|
|
484
|
+
|
|
485
|
+
### PowerShell tips (Windows)
|
|
486
|
+
|
|
487
|
+
1. **Always quote URLs** that contain `&` (shared links with `?igsh=...&...`).
|
|
488
|
+
2. Setting env vars and running `npx` on the **same line** requires a semicolon:
|
|
489
|
+
|
|
490
|
+
```powershell
|
|
491
|
+
$env:INSTAGRAM_COOKIES = "sessionid=..."; npx ultra-igdl "https://www.instagram.com/p/ABC/" --json
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
3. If you see errors about `npx` or `Unexpected token`, run env and `npx` on **separate lines**.
|
|
495
|
+
|
|
496
|
+
---
|
|
497
|
+
|
|
498
|
+
## 11. JavaScript / TypeScript API
|
|
499
|
+
|
|
500
|
+
### Create an instance
|
|
501
|
+
|
|
502
|
+
```ts
|
|
503
|
+
import { ultraigdl, type ApiResponse, type DownloadResponse } from "ultra-igdl";
|
|
504
|
+
|
|
505
|
+
const ig = new ultraigdl({
|
|
506
|
+
cache: true,
|
|
507
|
+
retries: 2,
|
|
508
|
+
cookies: process.env.INSTAGRAM_COOKIES,
|
|
509
|
+
});
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
### Methods
|
|
513
|
+
|
|
514
|
+
| Method | Returns | When to use |
|
|
515
|
+
|--------|---------|-------------|
|
|
516
|
+
| `download(url)` | `Promise<ApiResponse>` | Main method — full result |
|
|
517
|
+
| `info(url)` | `Promise<ApiResponse>` | Same as `download` |
|
|
518
|
+
| `validate(url)` | `Promise<{ valid, type?, normalized? }>` | Check URL before processing |
|
|
519
|
+
| `media(url)` | `Promise<Media[] \| ErrorResponse>` | Only the `media` array |
|
|
520
|
+
| `batch(urls)` | `Promise<BatchResult[]>` | Many URLs at once |
|
|
521
|
+
| `prefetch(url)` | `Promise<ApiResponse>` | Warm cache before `download` (bots) |
|
|
522
|
+
| `health()` | `Promise<HealthStatus>` | Version, cache size, connection pool |
|
|
523
|
+
| `clearCache()` | `void` | Clear in-memory cache |
|
|
524
|
+
|
|
525
|
+
### TypeScript — narrow success type
|
|
526
|
+
|
|
527
|
+
```ts
|
|
528
|
+
const result = await ig.download(url);
|
|
529
|
+
if (result.code === 200) {
|
|
530
|
+
const ok = result as DownloadResponse;
|
|
531
|
+
ok.media.forEach((m) => console.log(m.url));
|
|
532
|
+
}
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
### Download files yourself (library)
|
|
536
|
+
|
|
537
|
+
Use `fetch` or any HTTP client on `media[].url`, or use the CLI `--download` flag which handles saving for you.
|
|
538
|
+
|
|
539
|
+
```js
|
|
540
|
+
const res = await fetch(result.media[0].url);
|
|
541
|
+
const buf = Buffer.from(await res.arrayBuffer());
|
|
542
|
+
// write buf to disk with fs
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
**Do not modify** the CDN URL query string — links are signed and may break if edited.
|
|
546
|
+
|
|
547
|
+
### Exported utilities
|
|
548
|
+
|
|
549
|
+
```ts
|
|
550
|
+
import {
|
|
551
|
+
ultraigdl,
|
|
552
|
+
validateUrl,
|
|
553
|
+
parseInstagramUrl,
|
|
554
|
+
isInstagramUrl,
|
|
555
|
+
PACKAGE_VERSION,
|
|
556
|
+
EXTRACTOR_NAME,
|
|
557
|
+
} from "ultra-igdl";
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
Advanced: `DownloaderCore` is exported for custom integrations.
|
|
561
|
+
|
|
562
|
+
---
|
|
563
|
+
|
|
564
|
+
## 12. Configuration options
|
|
565
|
+
|
|
566
|
+
Pass these to `new ultraigdl({ ... })`:
|
|
567
|
+
|
|
568
|
+
| Option | Default | Description |
|
|
569
|
+
|--------|---------|-------------|
|
|
570
|
+
| `cache` | `true` | Cache responses in memory |
|
|
571
|
+
| `cacheTtlMs` | `300000` (5 min) | Fresh cache lifetime |
|
|
572
|
+
| `staleCacheTtlMs` | `86400000` (24 h) | Serve stale while refreshing |
|
|
573
|
+
| `cacheMaxSize` | `500` | Max cached entries |
|
|
574
|
+
| `timeoutMs` | `8000` | HTTP timeout per request |
|
|
575
|
+
| `retries` | `2` | Retry count on failure |
|
|
576
|
+
| `maxConcurrency` | `100` | Parallel request limit |
|
|
577
|
+
| `userAgentRotation` | `true` | Rotate browser user-agents |
|
|
578
|
+
| `sessionId` | — | Instagram `sessionid` cookie value |
|
|
579
|
+
| `cookies` | — | Full cookie header string |
|
|
580
|
+
| `verbose` | `false` | Extra logging |
|
|
581
|
+
| `fastMode` | `false` | Target ~500 ms response; may return 503 + retry hint |
|
|
582
|
+
| `responseBudgetMs` | — | Max time for `download()` to return |
|
|
583
|
+
| `redis` | — | Custom `RedisAdapter` for shared cache |
|
|
584
|
+
|
|
585
|
+
Example — tuned for a small API server:
|
|
586
|
+
|
|
587
|
+
```js
|
|
588
|
+
const ig = new ultraigdl({
|
|
589
|
+
cache: true,
|
|
590
|
+
cacheTtlMs: 600_000,
|
|
591
|
+
timeoutMs: 15_000,
|
|
592
|
+
retries: 3,
|
|
593
|
+
cookies: process.env.INSTAGRAM_COOKIES,
|
|
594
|
+
});
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
Example — low-latency bot (may need retry on 503):
|
|
598
|
+
|
|
599
|
+
```js
|
|
600
|
+
const ig = new ultraigdl({ fastMode: true, cookies: process.env.INSTAGRAM_COOKIES });
|
|
601
|
+
await ig.prefetch(url);
|
|
602
|
+
let result = await ig.download(url);
|
|
603
|
+
if (result.code === 503 && result.retryAfterMs) {
|
|
604
|
+
await new Promise((r) => setTimeout(r, result.retryAfterMs));
|
|
605
|
+
result = await ig.download(url);
|
|
606
|
+
}
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
---
|
|
610
|
+
|
|
611
|
+
## 13. Batch URLs and bots
|
|
612
|
+
|
|
613
|
+
### Batch in code
|
|
614
|
+
|
|
615
|
+
```js
|
|
616
|
+
const results = await ig.batch([
|
|
617
|
+
"https://www.instagram.com/p/A/",
|
|
618
|
+
"https://www.instagram.com/reel/B/",
|
|
619
|
+
]);
|
|
620
|
+
|
|
621
|
+
for (const { url, result, durationMs } of results) {
|
|
622
|
+
console.log(url, result.code, `${durationMs}ms`);
|
|
623
|
+
}
|
|
624
|
+
```
|
|
625
|
+
|
|
626
|
+
### Batch from CLI
|
|
627
|
+
|
|
628
|
+
Use a `.txt` file ([section 10](#10-command-line-cli--full-guide)).
|
|
629
|
+
|
|
630
|
+
### Redis cache (optional, advanced)
|
|
631
|
+
|
|
632
|
+
If you run multiple server instances, implement `RedisAdapter`:
|
|
633
|
+
|
|
634
|
+
```ts
|
|
635
|
+
import { ultraigdl, type RedisAdapter } from "ultra-igdl";
|
|
636
|
+
|
|
637
|
+
const redis: RedisAdapter = {
|
|
638
|
+
async get(key) { /* return string | null */ },
|
|
639
|
+
async set(key, value, ttlMs) { /* ... */ },
|
|
640
|
+
};
|
|
641
|
+
|
|
642
|
+
const ig = new ultraigdl({ redis });
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
---
|
|
646
|
+
|
|
647
|
+
## 14. Error codes and fixes
|
|
648
|
+
|
|
649
|
+
| Code | Meaning | What to try |
|
|
650
|
+
|------|---------|-------------|
|
|
651
|
+
| **400** | Invalid URL | Run `validate()`; fix the link |
|
|
652
|
+
| **403** | Private or blocked | Cannot access without permission |
|
|
653
|
+
| **404** | Not found | Post deleted, wrong ID, or expired story |
|
|
654
|
+
| **429** | Rate limited | Wait and slow down; fewer parallel requests |
|
|
655
|
+
| **500** | Server / parse error | Retry; update package; open an issue |
|
|
656
|
+
| **503** | Fast mode: still fetching | Wait `retryAfterMs` and call `download` again |
|
|
657
|
+
| **504** | Timeout | Increase `timeoutMs` |
|
|
658
|
+
|
|
659
|
+
---
|
|
660
|
+
|
|
661
|
+
## 15. FAQ and troubleshooting
|
|
662
|
+
|
|
663
|
+
**Q: Carousel only returns one image.**
|
|
664
|
+
A: Add `INSTAGRAM_COOKIES` or `sessionId` ([section 8](#8-instagram-session--why-and-how)).
|
|
665
|
+
|
|
666
|
+
**Q: Reel has no video, only thumbnail.**
|
|
667
|
+
A: Same — use a logged-in session cookie.
|
|
668
|
+
|
|
669
|
+
**Q: Story returns 404.**
|
|
670
|
+
A: Stories expire after 24 hours, or the URL is wrong. Session is required.
|
|
671
|
+
|
|
672
|
+
**Q: CLI works on Mac but fails on PowerShell.**
|
|
673
|
+
A: Quote the URL; set env vars on a separate line or use `;` before `npx`.
|
|
674
|
+
|
|
675
|
+
**Q: Downloaded file from CDN is corrupt or 403.**
|
|
676
|
+
A: Copy the `url` exactly from the API response. Do not strip query parameters.
|
|
677
|
+
|
|
678
|
+
**Q: Caption looks like one long line.**
|
|
679
|
+
A: Post captions are normalized to a single clean line by design (engagement text is in `engagement`, not `caption`).
|
|
680
|
+
|
|
681
|
+
**Q: How do I update?**
|
|
682
|
+
A: `npm update ultra-igdl` or bump version in `package.json` and run `npm install`.
|
|
683
|
+
|
|
684
|
+
**Q: Does this need an Instagram API key?**
|
|
685
|
+
A: No. It uses the same kind of page parsing and optional session API as a logged-in browser.
|
|
686
|
+
|
|
687
|
+
---
|
|
688
|
+
|
|
689
|
+
## 16. Examples in this repository
|
|
690
|
+
|
|
691
|
+
After cloning, build once: `npm run build`.
|
|
692
|
+
|
|
693
|
+
| File | What it shows |
|
|
694
|
+
|------|----------------|
|
|
695
|
+
| [`examples/basic.mjs`](./examples/basic.mjs) | Minimal JSON output |
|
|
696
|
+
| [`examples/bot-example.ts`](./examples/bot-example.ts) | Generic bot handler |
|
|
697
|
+
| [`examples/express-api.ts`](./examples/express-api.ts) | REST API with Express |
|
|
698
|
+
| [`examples/fastify-api.ts`](./examples/fastify-api.ts) | REST API with Fastify |
|
|
699
|
+
| [`examples/telegram-bot.ts`](./examples/telegram-bot.ts) | Telegram-style flow |
|
|
700
|
+
| [`examples/discord-bot.ts`](./examples/discord-bot.ts) | Discord-style flow |
|
|
701
|
+
| [`examples/cookie-generator.mjs`](./examples/cookie-generator.mjs) | Cookie setup notes |
|
|
702
|
+
|
|
703
|
+
Run basic example:
|
|
704
|
+
|
|
705
|
+
```bash
|
|
706
|
+
npm run build
|
|
707
|
+
node examples/basic.mjs "https://www.instagram.com/p/SHORTCODE/"
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
---
|
|
711
|
+
|
|
712
|
+
## 17. Legal and privacy
|
|
713
|
+
|
|
714
|
+
- **Not affiliated** with Instagram or Meta.
|
|
715
|
+
- You must follow **Instagram’s Terms of Use** and your local laws. Only download content you are allowed to use.
|
|
716
|
+
- **Session cookies are credentials** — never commit them, share them publicly, or log them in production.
|
|
717
|
+
- CDN URLs are **temporary signed links** — download soon; do not alter the URL.
|
|
718
|
+
|
|
719
|
+
---
|
|
720
|
+
|
|
721
|
+
## 18. License
|
|
722
|
+
|
|
723
|
+
[MIT](./LICENSE) — free to use with attribution.
|
|
724
|
+
|
|
725
|
+
---
|
|
726
|
+
|
|
727
|
+
**Need help?** Open an issue: [github.com/WH173-5P1D3R/ultra-igdl/issues](https://github.com/WH173-5P1D3R/ultra-igdl/issues)
|