@chilfish/gallery-dl-instagram 0.1.0 → 0.2.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/LICENSE +340 -0
- package/README.md +134 -0
- package/dist/dl-ins.mjs +5014 -0
- package/dist/index.cjs +192 -0
- package/dist/{sdk-B9fRyc1e.d.mts → index.d.cts} +189 -309
- package/dist/index.d.mts +502 -72
- package/dist/index.mjs +153 -39
- package/dist/node.cjs +41 -0
- package/dist/node.d.cts +47 -0
- package/dist/node.d.mts +47 -0
- package/dist/node.mjs +40 -0
- package/dist/sdk-BClg0Kv2.cjs +2268 -0
- package/dist/{extractors-Byw-2lPL.mjs → sdk-CovBsEps.mjs} +720 -670
- package/dist/sdk-DyZz22bT.d.cts +262 -0
- package/dist/sdk-DyZz22bT.d.mts +262 -0
- package/dist/storage-77hqz5Fi.mjs +24 -0
- package/dist/storage-BwGaT6XO.cjs +24 -0
- package/package.json +26 -26
- package/cli/adapter.ts +0 -284
- package/cli/cookies.ts +0 -59
- package/cli/index.ts +0 -337
- package/config.ts +0 -80
- package/core/extractor.ts +0 -217
- package/core/job.ts +0 -581
- package/dist/adapter-Bt86eL1R.mjs +0 -189
- package/dist/cli/index.d.mts +0 -1
- package/dist/cli/index.mjs +0 -3160
- package/dist/sdk.d.mts +0 -2
- package/dist/sdk.mjs +0 -93
- package/index.ts +0 -159
- package/instagram/api.ts +0 -531
- package/instagram/base.ts +0 -275
- package/instagram/extractors.ts +0 -521
- package/instagram/index.ts +0 -43
- package/instagram/parsers.ts +0 -583
- package/instagram/types.ts +0 -244
- package/message.ts +0 -31
- package/types.ts +0 -115
- package/utils/id-codec.ts +0 -39
- package/utils/text.ts +0 -178
|
@@ -1,201 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* which handler a Job should invoke.
|
|
7
|
-
*/
|
|
8
|
-
/** HTTP abstraction */
|
|
9
|
-
interface RequestConfig {
|
|
10
|
-
headers?: Record<string, string>;
|
|
11
|
-
params?: Record<string, string | number | null | undefined>;
|
|
12
|
-
method?: string;
|
|
13
|
-
data?: unknown;
|
|
14
|
-
timeout?: number;
|
|
15
|
-
signal?: AbortSignal;
|
|
16
|
-
/** WithCredentials / CORS cookie passthrough for browsers */
|
|
17
|
-
withCredentials?: boolean;
|
|
18
|
-
/** For binary downloads — 'arraybuffer' returns raw bytes */
|
|
19
|
-
responseType?: 'arraybuffer' | 'text' | 'json';
|
|
20
|
-
}
|
|
21
|
-
interface HttpResponse<T = unknown> {
|
|
1
|
+
import { _ as Metadata, a as ExtractorOptions, b as Storage, c as ConfigManager, d as DirectoryMsg, f as ExtractorClass, g as MessageIter, h as Message, i as Extractor, l as Config, m as HttpResponse, n as InstagramSDK, o as Logger, p as HttpClient, r as SDKOptions, s as noopLogger, t as ExtractOptions, u as ConfigValue, v as QueueMsg, x as UrlMsg, y as RequestConfig } from "./sdk-DyZz22bT.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/core/job.d.ts
|
|
4
|
+
declare abstract class Job {
|
|
5
|
+
readonly extractor: Extractor;
|
|
22
6
|
status: number;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
url: string;
|
|
32
|
-
method?: string;
|
|
33
|
-
headers?: Record<string, string>;
|
|
34
|
-
params?: Record<string, string | number | null | undefined>;
|
|
35
|
-
data?: unknown;
|
|
36
|
-
signal?: AbortSignal;
|
|
37
|
-
timeout?: number;
|
|
38
|
-
responseType?: 'arraybuffer' | 'text' | 'json';
|
|
39
|
-
}) => Promise<HttpResponse<T>>;
|
|
40
|
-
}
|
|
41
|
-
/** Storage abstraction */
|
|
42
|
-
interface Storage {
|
|
43
|
-
exists: (path: string) => Promise<boolean>;
|
|
44
|
-
write: (path: string, data: Uint8Array | string) => Promise<void>;
|
|
45
|
-
mkdir: (path: string) => Promise<void>;
|
|
46
|
-
}
|
|
47
|
-
type ConfigValue = string | number | boolean | null | ConfigValue[] | {
|
|
48
|
-
[key: string]: ConfigValue;
|
|
49
|
-
};
|
|
50
|
-
interface Config {
|
|
51
|
-
[key: string]: ConfigValue;
|
|
52
|
-
}
|
|
53
|
-
/** Metadata & messages */
|
|
54
|
-
/**
|
|
55
|
-
* Flat string-keyed metadata dictionary.
|
|
56
|
-
* In gallery-dl every kwdict is a plain `{string → value}` map.
|
|
57
|
-
*/
|
|
58
|
-
type Metadata = Record<string, unknown>;
|
|
59
|
-
interface DirectoryMsg {
|
|
60
|
-
readonly type: 'directory';
|
|
61
|
-
readonly metadata: Metadata;
|
|
62
|
-
}
|
|
63
|
-
interface UrlMsg {
|
|
64
|
-
readonly type: 'url';
|
|
65
|
-
readonly url: string;
|
|
66
|
-
readonly metadata: Metadata;
|
|
67
|
-
}
|
|
68
|
-
interface QueueMsg {
|
|
69
|
-
readonly type: 'queue';
|
|
70
|
-
readonly url: string;
|
|
71
|
-
readonly metadata: Metadata & {
|
|
72
|
-
readonly _extractor?: ExtractorClass;
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
type Message = DirectoryMsg | UrlMsg | QueueMsg;
|
|
76
|
-
/**
|
|
77
|
-
* Async generator that yields Message values.
|
|
78
|
-
*/
|
|
79
|
-
type MessageIter = AsyncGenerator<Message, void, unknown>;
|
|
80
|
-
/** Extractor class reference (for Queue dispatch) */
|
|
81
|
-
/**
|
|
82
|
-
* Minimal shape that every Extractor class must expose so the Dispatch
|
|
83
|
-
* logic can re-instantiate from a URL.
|
|
84
|
-
*/
|
|
85
|
-
interface ExtractorClass {
|
|
86
|
-
pattern: RegExp;
|
|
87
|
-
subcategory: string;
|
|
7
|
+
constructor(extractor: Extractor);
|
|
8
|
+
/** Main entry point. Dispatches every yielded message. */
|
|
9
|
+
run(): Promise<number>;
|
|
10
|
+
/** Override in subclasses to print a summary. */
|
|
11
|
+
protected _report(): void;
|
|
12
|
+
abstract handleDirectory(msg: DirectoryMsg): Promise<void>;
|
|
13
|
+
abstract handleUrl(msg: UrlMsg): Promise<void>;
|
|
14
|
+
abstract handleQueue(msg: QueueMsg): Promise<void>;
|
|
88
15
|
}
|
|
89
16
|
//#endregion
|
|
90
|
-
//#region
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
17
|
+
//#region src/core/download-job.d.ts
|
|
18
|
+
type ArchiveMap = Map<string, Set<string>>;
|
|
19
|
+
declare class DownloadJob extends Job {
|
|
20
|
+
/** Base output directory (prepended to all paths). */
|
|
21
|
+
basePath: string;
|
|
22
|
+
/** Current target directory metadata (set by directory messages). */
|
|
23
|
+
private _currentDir;
|
|
24
|
+
/** In-memory archive keyed by archive format. */
|
|
25
|
+
readonly archive: ArchiveMap;
|
|
26
|
+
private readonly _archiveFmts;
|
|
27
|
+
private _postCount;
|
|
28
|
+
private _fileCount;
|
|
29
|
+
private _downloadedBytes;
|
|
30
|
+
private _skippedCount;
|
|
31
|
+
registerArchive(category: string, format: string): void;
|
|
32
|
+
private _interp;
|
|
33
|
+
private _isArchived;
|
|
34
|
+
private _archive;
|
|
35
|
+
handleDirectory(msg: DirectoryMsg): Promise<void>;
|
|
36
|
+
handleUrl(msg: UrlMsg): Promise<void>;
|
|
37
|
+
handleQueue(msg: QueueMsg): Promise<void>;
|
|
38
|
+
protected _report(): void;
|
|
39
|
+
private _buildDirPath;
|
|
40
|
+
private _buildFilename;
|
|
107
41
|
}
|
|
108
42
|
//#endregion
|
|
109
|
-
//#region core/
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
error: (message: string, ...args: unknown[]) => void;
|
|
124
|
-
}
|
|
125
|
-
/** A no-op logger */
|
|
126
|
-
declare const noopLogger: Logger;
|
|
127
|
-
declare abstract class Extractor {
|
|
128
|
-
/** Human-readable category (e.g. ``'instagram'``) */
|
|
129
|
-
abstract readonly category: string;
|
|
130
|
-
/** Sub-category (e.g. ``'post'``, ``'posts'``, ``'reels'``) */
|
|
131
|
-
abstract readonly subcategory: string;
|
|
132
|
-
/** Root URL (e.g. ``'https://www.instagram.com'``) */
|
|
133
|
-
abstract readonly root: string;
|
|
134
|
-
/** Regex pattern to match against URLs */
|
|
135
|
-
static readonly pattern: RegExp;
|
|
136
|
-
/** The input URL */
|
|
137
|
-
readonly url: string;
|
|
138
|
-
/** Regex match groups from ``fromURL`` */
|
|
139
|
-
readonly groups: readonly string[];
|
|
140
|
-
readonly config: ConfigManager;
|
|
141
|
-
/** HTTP client — public so Job can access for downloads */
|
|
142
|
-
readonly http: HttpClient;
|
|
143
|
-
/** Storage backend — public so Job can access for writes */
|
|
144
|
-
readonly storage: Storage;
|
|
145
|
-
/** Logger instance — public so Job can access for reporting */
|
|
146
|
-
readonly log: Logger;
|
|
147
|
-
/** Delay range in seconds — random between [min, max] before each request */
|
|
148
|
-
protected requestInterval: [number, number];
|
|
149
|
-
private _initialized;
|
|
150
|
-
constructor(opts: ExtractorOptions);
|
|
151
|
-
/** Initialization */
|
|
152
|
-
/**
|
|
153
|
-
* One-time async setup (cookies, session, internal state).
|
|
154
|
-
* Safe to call multiple times — after the first call it becomes a no-op.
|
|
155
|
-
*/
|
|
156
|
-
initialize(): Promise<void>;
|
|
157
|
-
/**
|
|
158
|
-
* Subclass hook for one-time setup.
|
|
159
|
-
*/
|
|
160
|
-
protected _init(): Promise<void>;
|
|
161
|
-
/** Async iteration */
|
|
162
|
-
[Symbol.asyncIterator](): MessageIter;
|
|
163
|
-
/**
|
|
164
|
-
* The main extraction pipeline. Subclasses *must* implement this.
|
|
165
|
-
*/
|
|
166
|
-
abstract items(): MessageIter;
|
|
167
|
-
/** Config helpers */
|
|
168
|
-
/**
|
|
169
|
-
* Read a config value using the interpolated hierarchy.
|
|
170
|
-
*/
|
|
171
|
-
protected _cfg(key: string, defaultVal?: ConfigValue): ConfigValue | undefined;
|
|
172
|
-
/** HTTP */
|
|
173
|
-
private _lastRequestTime;
|
|
174
|
-
/**
|
|
175
|
-
* Rate-limited HTTP request wrapper.
|
|
176
|
-
*/
|
|
177
|
-
request(url: string, cfg?: RequestConfig): Promise<HttpResponse<unknown>>;
|
|
178
|
-
/**
|
|
179
|
-
* Convenience: request + parse JSON body.
|
|
180
|
-
*/
|
|
181
|
-
requestJSON(url: string, cfg?: RequestConfig): Promise<unknown>;
|
|
182
|
-
/** Rate limiting */
|
|
183
|
-
/**
|
|
184
|
-
* Sleep long enough to keep the minimum interval between requests.
|
|
185
|
-
*/
|
|
186
|
-
private _throttle;
|
|
187
|
-
/** Utility */
|
|
188
|
-
/**
|
|
189
|
-
* Convert a Unix timestamp (seconds or ms) to an ISO-8601 string.
|
|
190
|
-
*/
|
|
191
|
-
parseTimestamp(ts: number | null | undefined): string;
|
|
192
|
-
/**
|
|
193
|
-
* Generate a random hex token (used for CSRF).
|
|
194
|
-
*/
|
|
195
|
-
static generateToken(size?: number): string;
|
|
43
|
+
//#region src/core/print-job.d.ts
|
|
44
|
+
declare class PrintJob extends Job {
|
|
45
|
+
private _currentDir;
|
|
46
|
+
private _files;
|
|
47
|
+
private _postCount;
|
|
48
|
+
private _fileCount;
|
|
49
|
+
private _width;
|
|
50
|
+
constructor(extractor: Extractor);
|
|
51
|
+
handleDirectory(msg: DirectoryMsg): Promise<void>;
|
|
52
|
+
handleUrl(msg: UrlMsg): Promise<void>;
|
|
53
|
+
handleQueue(msg: QueueMsg): Promise<void>;
|
|
54
|
+
private _flushPost;
|
|
55
|
+
private _wrap;
|
|
56
|
+
protected _report(): void;
|
|
196
57
|
}
|
|
197
58
|
//#endregion
|
|
198
|
-
//#region instagram/types.d.ts
|
|
59
|
+
//#region src/instagram/types.d.ts
|
|
199
60
|
/**
|
|
200
61
|
* Instagram API & parsed-post type definitions.
|
|
201
62
|
*
|
|
@@ -441,7 +302,7 @@ interface ParserConfig {
|
|
|
441
302
|
videosDash: boolean;
|
|
442
303
|
}
|
|
443
304
|
//#endregion
|
|
444
|
-
//#region instagram/api.d.ts
|
|
305
|
+
//#region src/instagram/api.d.ts
|
|
445
306
|
declare class InstagramRestAPI {
|
|
446
307
|
private readonly http;
|
|
447
308
|
private readonly root;
|
|
@@ -519,7 +380,7 @@ declare class InstagramRestAPI {
|
|
|
519
380
|
private _parseIntCursor;
|
|
520
381
|
}
|
|
521
382
|
//#endregion
|
|
522
|
-
//#region instagram/base.d.ts
|
|
383
|
+
//#region src/instagram/base.d.ts
|
|
523
384
|
interface InstagramExtractorOptions extends ExtractorOptions {
|
|
524
385
|
sessionId?: string;
|
|
525
386
|
cookies?: Record<string, string>;
|
|
@@ -561,24 +422,48 @@ declare abstract class InstagramExtractor extends Extractor {
|
|
|
561
422
|
protected _assignUser(user: InstagramUser): void;
|
|
562
423
|
}
|
|
563
424
|
//#endregion
|
|
564
|
-
//#region instagram/extractors.d.ts
|
|
565
|
-
declare class
|
|
566
|
-
static readonly subcategory = "
|
|
425
|
+
//#region src/instagram/extractors/avatar.d.ts
|
|
426
|
+
declare class InstagramAvatarExtractor extends InstagramExtractor {
|
|
427
|
+
static readonly subcategory = "avatar";
|
|
567
428
|
static pattern: RegExp;
|
|
568
|
-
readonly subcategory = "
|
|
429
|
+
readonly subcategory = "avatar";
|
|
569
430
|
constructor(opts: InstagramExtractorOptions);
|
|
570
|
-
static fromURL(url: string, opts: InstagramExtractorOptions):
|
|
431
|
+
static fromURL(url: string, opts: InstagramExtractorOptions): InstagramAvatarExtractor | null;
|
|
571
432
|
posts(): AsyncGenerator<InstagramPost>;
|
|
572
433
|
}
|
|
573
|
-
|
|
574
|
-
|
|
434
|
+
//#endregion
|
|
435
|
+
//#region src/instagram/extractors/highlights.d.ts
|
|
436
|
+
declare class InstagramHighlightsExtractor extends InstagramExtractor {
|
|
437
|
+
static readonly subcategory = "highlights";
|
|
575
438
|
static pattern: RegExp;
|
|
576
|
-
readonly subcategory = "
|
|
439
|
+
readonly subcategory = "highlights";
|
|
577
440
|
constructor(opts: InstagramExtractorOptions);
|
|
578
|
-
static fromURL(url: string, opts: InstagramExtractorOptions):
|
|
441
|
+
static fromURL(url: string, opts: InstagramExtractorOptions): InstagramHighlightsExtractor | null;
|
|
442
|
+
posts(): AsyncGenerator<InstagramPost>;
|
|
443
|
+
}
|
|
444
|
+
//#endregion
|
|
445
|
+
//#region src/instagram/extractors/info.d.ts
|
|
446
|
+
declare class InstagramInfoExtractor extends InstagramExtractor {
|
|
447
|
+
static readonly subcategory = "info";
|
|
448
|
+
static pattern: RegExp;
|
|
449
|
+
readonly subcategory = "info";
|
|
450
|
+
constructor(opts: InstagramExtractorOptions);
|
|
451
|
+
static fromURL(url: string, opts: InstagramExtractorOptions): InstagramInfoExtractor | null;
|
|
579
452
|
items(): MessageIter;
|
|
580
453
|
posts(): AsyncGenerator<InstagramPost>;
|
|
581
454
|
}
|
|
455
|
+
//#endregion
|
|
456
|
+
//#region src/instagram/extractors/post.d.ts
|
|
457
|
+
declare class InstagramPostExtractor extends InstagramExtractor {
|
|
458
|
+
static readonly subcategory = "post";
|
|
459
|
+
static pattern: RegExp;
|
|
460
|
+
readonly subcategory = "post";
|
|
461
|
+
constructor(opts: InstagramExtractorOptions);
|
|
462
|
+
static fromURL(url: string, opts: InstagramExtractorOptions): InstagramPostExtractor | null;
|
|
463
|
+
posts(): AsyncGenerator<InstagramPost>;
|
|
464
|
+
}
|
|
465
|
+
//#endregion
|
|
466
|
+
//#region src/instagram/extractors/posts-list.d.ts
|
|
582
467
|
declare class InstagramPostsExtractor extends InstagramExtractor {
|
|
583
468
|
static readonly subcategory = "posts";
|
|
584
469
|
static pattern: RegExp;
|
|
@@ -587,6 +472,8 @@ declare class InstagramPostsExtractor extends InstagramExtractor {
|
|
|
587
472
|
static fromURL(url: string, opts: InstagramExtractorOptions): InstagramPostsExtractor | null;
|
|
588
473
|
posts(): AsyncGenerator<InstagramPost>;
|
|
589
474
|
}
|
|
475
|
+
//#endregion
|
|
476
|
+
//#region src/instagram/extractors/reels-list.d.ts
|
|
590
477
|
declare class InstagramReelsExtractor extends InstagramExtractor {
|
|
591
478
|
static readonly subcategory = "reels";
|
|
592
479
|
static pattern: RegExp;
|
|
@@ -595,16 +482,18 @@ declare class InstagramReelsExtractor extends InstagramExtractor {
|
|
|
595
482
|
static fromURL(url: string, opts: InstagramExtractorOptions): InstagramReelsExtractor | null;
|
|
596
483
|
posts(): AsyncGenerator<InstagramPost>;
|
|
597
484
|
}
|
|
598
|
-
|
|
599
|
-
|
|
485
|
+
//#endregion
|
|
486
|
+
//#region src/instagram/extractors/saved.d.ts
|
|
487
|
+
declare class InstagramSavedExtractor extends InstagramExtractor {
|
|
488
|
+
static readonly subcategory = "saved";
|
|
600
489
|
static pattern: RegExp;
|
|
601
|
-
readonly subcategory = "
|
|
602
|
-
private _taggedUserId;
|
|
490
|
+
readonly subcategory = "saved";
|
|
603
491
|
constructor(opts: InstagramExtractorOptions);
|
|
604
|
-
static fromURL(url: string, opts: InstagramExtractorOptions):
|
|
605
|
-
metadata(): Promise<Record<string, unknown>>;
|
|
492
|
+
static fromURL(url: string, opts: InstagramExtractorOptions): InstagramSavedExtractor | null;
|
|
606
493
|
posts(): AsyncGenerator<InstagramPost>;
|
|
607
494
|
}
|
|
495
|
+
//#endregion
|
|
496
|
+
//#region src/instagram/extractors/stories.d.ts
|
|
608
497
|
declare class InstagramStoriesExtractor extends InstagramExtractor {
|
|
609
498
|
static readonly subcategory = "stories";
|
|
610
499
|
static pattern: RegExp;
|
|
@@ -615,14 +504,8 @@ declare class InstagramStoriesExtractor extends InstagramExtractor {
|
|
|
615
504
|
static fromURL(url: string, opts: InstagramExtractorOptions): InstagramStoriesExtractor | null;
|
|
616
505
|
posts(): AsyncGenerator<InstagramPost>;
|
|
617
506
|
}
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
static pattern: RegExp;
|
|
621
|
-
readonly subcategory = "highlights";
|
|
622
|
-
constructor(opts: InstagramExtractorOptions);
|
|
623
|
-
static fromURL(url: string, opts: InstagramExtractorOptions): InstagramHighlightsExtractor | null;
|
|
624
|
-
posts(): AsyncGenerator<InstagramPost>;
|
|
625
|
-
}
|
|
507
|
+
//#endregion
|
|
508
|
+
//#region src/instagram/extractors/tag.d.ts
|
|
626
509
|
declare class InstagramTagExtractor extends InstagramExtractor {
|
|
627
510
|
static readonly subcategory = "tag";
|
|
628
511
|
static pattern: RegExp;
|
|
@@ -632,106 +515,103 @@ declare class InstagramTagExtractor extends InstagramExtractor {
|
|
|
632
515
|
metadata(): Promise<Record<string, unknown>>;
|
|
633
516
|
posts(): AsyncGenerator<InstagramPost>;
|
|
634
517
|
}
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
readonly subcategory = "
|
|
639
|
-
constructor(opts: InstagramExtractorOptions);
|
|
640
|
-
static fromURL(url: string, opts: InstagramExtractorOptions): InstagramInfoExtractor | null;
|
|
641
|
-
items(): MessageIter;
|
|
642
|
-
posts(): AsyncGenerator<InstagramPost>;
|
|
643
|
-
}
|
|
644
|
-
declare class InstagramAvatarExtractor extends InstagramExtractor {
|
|
645
|
-
static readonly subcategory = "avatar";
|
|
518
|
+
//#endregion
|
|
519
|
+
//#region src/instagram/extractors/tagged.d.ts
|
|
520
|
+
declare class InstagramTaggedExtractor extends InstagramExtractor {
|
|
521
|
+
static readonly subcategory = "tagged";
|
|
646
522
|
static pattern: RegExp;
|
|
647
|
-
readonly subcategory = "
|
|
523
|
+
readonly subcategory = "tagged";
|
|
524
|
+
private _taggedUserId;
|
|
648
525
|
constructor(opts: InstagramExtractorOptions);
|
|
649
|
-
static fromURL(url: string, opts: InstagramExtractorOptions):
|
|
526
|
+
static fromURL(url: string, opts: InstagramExtractorOptions): InstagramTaggedExtractor | null;
|
|
527
|
+
metadata(): Promise<Record<string, unknown>>;
|
|
650
528
|
posts(): AsyncGenerator<InstagramPost>;
|
|
651
529
|
}
|
|
652
|
-
|
|
653
|
-
|
|
530
|
+
//#endregion
|
|
531
|
+
//#region src/instagram/extractors/user.d.ts
|
|
532
|
+
declare class InstagramUserExtractor extends InstagramExtractor {
|
|
533
|
+
static readonly subcategory = "user";
|
|
654
534
|
static pattern: RegExp;
|
|
655
|
-
readonly subcategory = "
|
|
535
|
+
readonly subcategory = "user";
|
|
656
536
|
constructor(opts: InstagramExtractorOptions);
|
|
657
|
-
static fromURL(url: string, opts: InstagramExtractorOptions):
|
|
537
|
+
static fromURL(url: string, opts: InstagramExtractorOptions): InstagramUserExtractor | null;
|
|
538
|
+
items(): MessageIter;
|
|
658
539
|
posts(): AsyncGenerator<InstagramPost>;
|
|
659
540
|
}
|
|
660
541
|
//#endregion
|
|
661
|
-
//#region
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
}
|
|
542
|
+
//#region src/instagram/parsers/graphql.d.ts
|
|
543
|
+
/** Parse a GraphQL post/edge response. */
|
|
544
|
+
declare function parsePostGraphql(post: Record<string, unknown>, cfg: ParserConfig): ParsedPost;
|
|
545
|
+
//#endregion
|
|
546
|
+
//#region src/instagram/parsers/rest.d.ts
|
|
547
|
+
/** Main entry — parse a REST post response. */
|
|
548
|
+
declare function parsePostRest(post: InstagramPost, cfg: ParserConfig): ParsedPost;
|
|
549
|
+
/** Extract tagged users from various field formats. */
|
|
550
|
+
declare function extractTaggedUsers(src: Record<string, unknown>, dest: ParsedMedia): void;
|
|
551
|
+
/** Extract audio/music metadata from a story sticker. */
|
|
552
|
+
declare function extractAudio(src: Record<string, unknown>, dest: Record<string, unknown>, sticker: MusicSticker, cfg: ParserConfig): ParsedMedia | null;
|
|
553
|
+
//#endregion
|
|
554
|
+
//#region src/message.d.ts
|
|
555
|
+
declare function directory(metadata?: Metadata): DirectoryMsg;
|
|
556
|
+
declare function url(u: string, metadata?: Metadata): UrlMsg;
|
|
557
|
+
declare function queue(u: string, metadata?: Metadata & {
|
|
558
|
+
_extractor?: ExtractorClass;
|
|
559
|
+
}): QueueMsg;
|
|
560
|
+
//#endregion
|
|
561
|
+
//#region src/utils/id-codec.d.ts
|
|
562
|
+
/**
|
|
563
|
+
* Instagram-style Base64-variant ID ↔ shortcode conversion.
|
|
564
|
+
*/
|
|
565
|
+
/**
|
|
566
|
+
* Decode an Instagram shortcode into its numeric post ID.
|
|
567
|
+
*/
|
|
568
|
+
declare function idFromShortcode(shortcode: string): string;
|
|
569
|
+
/**
|
|
570
|
+
* Encode a numeric post ID into an Instagram shortcode.
|
|
571
|
+
*/
|
|
572
|
+
declare function shortcodeFromId(postId: string | number): string;
|
|
573
|
+
//#endregion
|
|
574
|
+
//#region src/utils/text.d.ts
|
|
575
|
+
/**
|
|
576
|
+
* Text utilities ported from gallery-dl's ``text`` module.
|
|
577
|
+
*
|
|
578
|
+
* All functions are pure and environment-agnostic.
|
|
579
|
+
*/
|
|
580
|
+
/** String extraction */
|
|
581
|
+
/**
|
|
582
|
+
* Extract the substring between ``begin`` and ``end`` from ``txt``.
|
|
583
|
+
* Returns the substring or ``null`` if either delimiter is missing.
|
|
584
|
+
*/
|
|
585
|
+
declare function extract(txt: string, begin: string, end: string): string | null;
|
|
586
|
+
/**
|
|
587
|
+
* Shorthand: same as ``extract`` but returns ``default_`` on failure.
|
|
588
|
+
* Mirrors the Python ``extr()`` function.
|
|
589
|
+
*/
|
|
590
|
+
declare function extr(txt: string, begin: string, end: string, default_?: string): string;
|
|
591
|
+
/** Unicode / HTML */
|
|
592
|
+
/**
|
|
593
|
+
* Decode ``\\uXXXX`` escape sequences in a string.
|
|
594
|
+
*/
|
|
595
|
+
declare function parseUnicodeEscapes(text: string): string;
|
|
596
|
+
declare function unescape(text: string): string;
|
|
597
|
+
/** URL helpers */
|
|
598
|
+
/**
|
|
599
|
+
* URL-decode a string.
|
|
600
|
+
*/
|
|
601
|
+
declare function unquote(text: string): string;
|
|
602
|
+
/**
|
|
603
|
+
* Ensure a URL starts with ``https://`` (or ``http://``).
|
|
604
|
+
*/
|
|
605
|
+
declare function ensureHttpScheme(url: string, scheme?: string): string;
|
|
606
|
+
/**
|
|
607
|
+
* Extract filename + extension from a URL and write into ``meta``.
|
|
608
|
+
*/
|
|
609
|
+
declare function nameExtFromURL(url: string, meta: Record<string, unknown>): void;
|
|
610
|
+
/**
|
|
611
|
+
* Parse an integer from a possibly-null value. Returns ``default_`` on failure.
|
|
612
|
+
*/
|
|
613
|
+
declare function parseInt(value: string | number | null | undefined, default_?: number): number;
|
|
614
|
+
/** Pre-configured hashtag regex. */
|
|
615
|
+
declare const findTags: (text: string) => string[];
|
|
736
616
|
//#endregion
|
|
737
|
-
export {
|
|
617
|
+
export { type Coauthor, type Config, ConfigManager, type ConfigValue, type DirectoryMsg, DownloadJob, type ExtractOptions, Extractor, type ExtractorClass, type ExtractorOptions, type HttpClient, type HttpResponse, type ImageCandidate, InstagramAvatarExtractor, type InstagramCarouselItem, InstagramExtractor, type InstagramExtractorOptions, InstagramHighlightsExtractor, InstagramInfoExtractor, type InstagramLocation, type InstagramPost, InstagramPostExtractor, InstagramPostsExtractor, InstagramReelsExtractor, InstagramRestAPI, InstagramSDK, InstagramSavedExtractor, InstagramStoriesExtractor, InstagramTagExtractor, InstagramTaggedExtractor, type InstagramUser, InstagramUserExtractor, Job, type Logger, type Message, type MessageIter, type Metadata, type ParsedMedia, type ParsedPost, type ParserConfig, PrintJob, type QueueMsg, type RequestConfig, type SDKOptions, type Storage, type TaggedUser, type UrlMsg, type VideoVersion, directory, ensureHttpScheme, extr, extract, extractAudio, extractTaggedUsers, findTags, idFromShortcode, nameExtFromURL, noopLogger, parseInt, parsePostGraphql, parsePostRest, parseUnicodeEscapes, queue, shortcodeFromId, unescape, unquote, url };
|