@chilfish/gallery-dl-instagram 0.1.0 → 0.2.0
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/adapter-CFsiiEpM.cjs +83 -0
- package/dist/adapter-tSleX8Cr.mjs +59 -0
- package/dist/dl-ins.mjs +5129 -0
- package/dist/index.cjs +40 -0
- package/dist/{sdk-B9fRyc1e.d.mts → index.d.cts} +139 -270
- package/dist/index.d.mts +470 -51
- package/dist/index.mjs +2 -40
- package/dist/node.cjs +43 -0
- package/dist/node.d.cts +47 -0
- package/dist/node.d.mts +47 -0
- package/dist/node.mjs +42 -0
- package/dist/{extractors-Byw-2lPL.mjs → sdk-Bn0VCUIT.mjs} +291 -215
- package/dist/sdk-CK9x5wFL.d.cts +259 -0
- package/dist/sdk-CK9x5wFL.d.mts +259 -0
- package/dist/sdk-nzhAxf1O.cjs +2246 -0
- package/dist/storage-77hqz5Fi.mjs +24 -0
- package/dist/storage-BwGaT6XO.cjs +24 -0
- package/package.json +32 -25
- 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
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_sdk = require("./sdk-nzhAxf1O.cjs");
|
|
3
|
+
exports.ConfigManager = require_sdk.ConfigManager;
|
|
4
|
+
exports.DownloadJob = require_sdk.DownloadJob;
|
|
5
|
+
exports.Extractor = require_sdk.Extractor;
|
|
6
|
+
exports.InstagramAvatarExtractor = require_sdk.InstagramAvatarExtractor;
|
|
7
|
+
exports.InstagramExtractor = require_sdk.InstagramExtractor;
|
|
8
|
+
exports.InstagramHighlightsExtractor = require_sdk.InstagramHighlightsExtractor;
|
|
9
|
+
exports.InstagramInfoExtractor = require_sdk.InstagramInfoExtractor;
|
|
10
|
+
exports.InstagramPostExtractor = require_sdk.InstagramPostExtractor;
|
|
11
|
+
exports.InstagramPostsExtractor = require_sdk.InstagramPostsExtractor;
|
|
12
|
+
exports.InstagramReelsExtractor = require_sdk.InstagramReelsExtractor;
|
|
13
|
+
exports.InstagramRestAPI = require_sdk.InstagramRestAPI;
|
|
14
|
+
exports.InstagramSDK = require_sdk.InstagramSDK;
|
|
15
|
+
exports.InstagramSavedExtractor = require_sdk.InstagramSavedExtractor;
|
|
16
|
+
exports.InstagramStoriesExtractor = require_sdk.InstagramStoriesExtractor;
|
|
17
|
+
exports.InstagramTagExtractor = require_sdk.InstagramTagExtractor;
|
|
18
|
+
exports.InstagramTaggedExtractor = require_sdk.InstagramTaggedExtractor;
|
|
19
|
+
exports.InstagramUserExtractor = require_sdk.InstagramUserExtractor;
|
|
20
|
+
exports.Job = require_sdk.Job;
|
|
21
|
+
exports.PrintJob = require_sdk.PrintJob;
|
|
22
|
+
exports.directory = require_sdk.directory;
|
|
23
|
+
exports.ensureHttpScheme = require_sdk.ensureHttpScheme;
|
|
24
|
+
exports.extr = require_sdk.extr;
|
|
25
|
+
exports.extract = require_sdk.extract;
|
|
26
|
+
exports.extractAudio = require_sdk.extractAudio;
|
|
27
|
+
exports.extractTaggedUsers = require_sdk.extractTaggedUsers;
|
|
28
|
+
exports.findTags = require_sdk.findTags;
|
|
29
|
+
exports.idFromShortcode = require_sdk.idFromShortcode;
|
|
30
|
+
exports.nameExtFromURL = require_sdk.nameExtFromURL;
|
|
31
|
+
exports.noopLogger = require_sdk.noopLogger;
|
|
32
|
+
exports.parseInt = require_sdk.parseInt;
|
|
33
|
+
exports.parsePostGraphql = require_sdk.parsePostGraphql;
|
|
34
|
+
exports.parsePostRest = require_sdk.parsePostRest;
|
|
35
|
+
exports.parseUnicodeEscapes = require_sdk.parseUnicodeEscapes;
|
|
36
|
+
exports.queue = require_sdk.queue;
|
|
37
|
+
exports.shortcodeFromId = require_sdk.shortcodeFromId;
|
|
38
|
+
exports.unescape = require_sdk.unescape;
|
|
39
|
+
exports.unquote = require_sdk.unquote;
|
|
40
|
+
exports.url = require_sdk.url;
|
|
@@ -1,201 +1,73 @@
|
|
|
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-CK9x5wFL.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/core/job.d.ts
|
|
4
|
+
declare abstract class Job {
|
|
5
|
+
readonly extractor: Extractor;
|
|
22
6
|
status: number;
|
|
23
|
-
|
|
24
|
-
headers: Record<string, string>;
|
|
25
|
-
/** Final URL after redirects */
|
|
26
|
-
url: string;
|
|
27
|
-
request?: RequestConfig;
|
|
28
|
-
}
|
|
29
|
-
interface HttpClient {
|
|
30
|
-
request: <T = unknown>(config: {
|
|
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;
|
|
88
|
-
}
|
|
89
|
-
//#endregion
|
|
90
|
-
//#region config.d.ts
|
|
91
|
-
declare class ConfigManager {
|
|
92
|
-
private readonly data;
|
|
93
|
-
constructor(data?: Config);
|
|
94
|
-
/**
|
|
95
|
-
* Read a value at a dot-path like ``'extractor.instagram.videos'``.
|
|
96
|
-
* Returns ``undefined`` when the path doesn't exist.
|
|
97
|
-
*/
|
|
98
|
-
get(path: string, defaultValue?: ConfigValue): ConfigValue | undefined;
|
|
7
|
+
constructor(extractor: Extractor);
|
|
99
8
|
/**
|
|
100
|
-
*
|
|
9
|
+
* Main entry point. Calls ``extractor[Symbol.asyncIterator]()`` and
|
|
10
|
+
* dispatches every yielded message.
|
|
101
11
|
*/
|
|
102
|
-
|
|
12
|
+
run(): Promise<number>;
|
|
13
|
+
/** Override in subclasses to print a summary. */
|
|
14
|
+
protected _report(): void;
|
|
15
|
+
abstract handleDirectory(msg: DirectoryMsg): Promise<void>;
|
|
16
|
+
abstract handleUrl(msg: UrlMsg): Promise<void>;
|
|
17
|
+
abstract handleQueue(msg: QueueMsg): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
/** An in-memory archive: category → Set<archive-key>. */
|
|
20
|
+
type ArchiveMap = Map<string, Set<string>>;
|
|
21
|
+
declare class DownloadJob extends Job {
|
|
22
|
+
/** Base output directory (prepended to all paths). */
|
|
23
|
+
basePath: string;
|
|
24
|
+
/** Current target directory metadata (set by directory messages). */
|
|
25
|
+
private _currentDir;
|
|
26
|
+
/** In-memory archive keyed by archive format. */
|
|
27
|
+
readonly archive: ArchiveMap;
|
|
103
28
|
/**
|
|
104
|
-
*
|
|
29
|
+
* Registry of per-category "archive formats" — the key is formed
|
|
30
|
+
* by interpolating this format string over the metadata.
|
|
105
31
|
*/
|
|
106
|
-
|
|
32
|
+
private readonly _archiveFmts;
|
|
33
|
+
private _postCount;
|
|
34
|
+
private _fileCount;
|
|
35
|
+
private _downloadedBytes;
|
|
36
|
+
private _skippedCount;
|
|
37
|
+
registerArchive(category: string, format: string): void;
|
|
38
|
+
/** Simple format-string interpolation for archive keys. */
|
|
39
|
+
private _interp;
|
|
40
|
+
/** Check whether this URL has already been downloaded (and skip). */
|
|
41
|
+
private _isArchived;
|
|
42
|
+
/** Mark a post/media as archived. */
|
|
43
|
+
private _archive;
|
|
44
|
+
/** Handlers */
|
|
45
|
+
handleDirectory(msg: DirectoryMsg): Promise<void>;
|
|
46
|
+
handleUrl(msg: UrlMsg): Promise<void>;
|
|
47
|
+
handleQueue(msg: QueueMsg): Promise<void>;
|
|
48
|
+
/** Report */
|
|
49
|
+
protected _report(): void;
|
|
50
|
+
/** Path builders */
|
|
51
|
+
private _buildDirPath;
|
|
52
|
+
private _buildFilename;
|
|
53
|
+
}
|
|
54
|
+
declare class PrintJob extends Job {
|
|
55
|
+
private _currentDir;
|
|
56
|
+
private _files;
|
|
57
|
+
private _postCount;
|
|
58
|
+
private _fileCount;
|
|
59
|
+
private _width;
|
|
60
|
+
constructor(extractor: Extractor);
|
|
61
|
+
handleDirectory(msg: DirectoryMsg): Promise<void>;
|
|
62
|
+
handleUrl(msg: UrlMsg): Promise<void>;
|
|
63
|
+
handleQueue(msg: QueueMsg): Promise<void>;
|
|
64
|
+
/** Output */
|
|
65
|
+
private _flushPost;
|
|
66
|
+
private _wrap;
|
|
67
|
+
protected _report(): void;
|
|
107
68
|
}
|
|
108
69
|
//#endregion
|
|
109
|
-
//#region
|
|
110
|
-
interface ExtractorOptions {
|
|
111
|
-
url: string;
|
|
112
|
-
match: RegExpMatchArray;
|
|
113
|
-
config: ConfigManager;
|
|
114
|
-
http: HttpClient;
|
|
115
|
-
storage: Storage;
|
|
116
|
-
/** The logger interface — at minimum a debug/info/warn/error contract */
|
|
117
|
-
log: Logger;
|
|
118
|
-
}
|
|
119
|
-
interface Logger {
|
|
120
|
-
debug: (message: string, ...args: unknown[]) => void;
|
|
121
|
-
info: (message: string, ...args: unknown[]) => void;
|
|
122
|
-
warn: (message: string, ...args: unknown[]) => void;
|
|
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;
|
|
196
|
-
}
|
|
197
|
-
//#endregion
|
|
198
|
-
//#region instagram/types.d.ts
|
|
70
|
+
//#region src/instagram/types.d.ts
|
|
199
71
|
/**
|
|
200
72
|
* Instagram API & parsed-post type definitions.
|
|
201
73
|
*
|
|
@@ -441,7 +313,7 @@ interface ParserConfig {
|
|
|
441
313
|
videosDash: boolean;
|
|
442
314
|
}
|
|
443
315
|
//#endregion
|
|
444
|
-
//#region instagram/api.d.ts
|
|
316
|
+
//#region src/instagram/api.d.ts
|
|
445
317
|
declare class InstagramRestAPI {
|
|
446
318
|
private readonly http;
|
|
447
319
|
private readonly root;
|
|
@@ -519,7 +391,7 @@ declare class InstagramRestAPI {
|
|
|
519
391
|
private _parseIntCursor;
|
|
520
392
|
}
|
|
521
393
|
//#endregion
|
|
522
|
-
//#region instagram/base.d.ts
|
|
394
|
+
//#region src/instagram/base.d.ts
|
|
523
395
|
interface InstagramExtractorOptions extends ExtractorOptions {
|
|
524
396
|
sessionId?: string;
|
|
525
397
|
cookies?: Record<string, string>;
|
|
@@ -561,7 +433,7 @@ declare abstract class InstagramExtractor extends Extractor {
|
|
|
561
433
|
protected _assignUser(user: InstagramUser): void;
|
|
562
434
|
}
|
|
563
435
|
//#endregion
|
|
564
|
-
//#region instagram/extractors.d.ts
|
|
436
|
+
//#region src/instagram/extractors.d.ts
|
|
565
437
|
declare class InstagramPostExtractor extends InstagramExtractor {
|
|
566
438
|
static readonly subcategory = "post";
|
|
567
439
|
static pattern: RegExp;
|
|
@@ -658,80 +530,77 @@ declare class InstagramSavedExtractor extends InstagramExtractor {
|
|
|
658
530
|
posts(): AsyncGenerator<InstagramPost>;
|
|
659
531
|
}
|
|
660
532
|
//#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
|
-
private _resolve;
|
|
735
|
-
}
|
|
533
|
+
//#region src/instagram/parsers.d.ts
|
|
534
|
+
/** Main entry — REST */
|
|
535
|
+
declare function parsePostRest(post: InstagramPost, cfg: ParserConfig): ParsedPost;
|
|
536
|
+
/** Tagged users */
|
|
537
|
+
declare function extractTaggedUsers(src: Record<string, unknown>, dest: ParsedMedia): void;
|
|
538
|
+
/** Audio / music extraction */
|
|
539
|
+
declare function extractAudio(src: Record<string, unknown>, dest: Record<string, unknown>, sticker: MusicSticker, cfg: ParserConfig): ParsedMedia | null;
|
|
540
|
+
/** GraphQL parser */
|
|
541
|
+
declare function parsePostGraphql(post: Record<string, unknown>, cfg: ParserConfig): ParsedPost;
|
|
542
|
+
//#endregion
|
|
543
|
+
//#region src/message.d.ts
|
|
544
|
+
declare function directory(metadata?: Metadata): DirectoryMsg;
|
|
545
|
+
declare function url(u: string, metadata?: Metadata): UrlMsg;
|
|
546
|
+
declare function queue(u: string, metadata?: Metadata & {
|
|
547
|
+
_extractor?: ExtractorClass;
|
|
548
|
+
}): QueueMsg;
|
|
549
|
+
//#endregion
|
|
550
|
+
//#region src/utils/id-codec.d.ts
|
|
551
|
+
/**
|
|
552
|
+
* Instagram-style Base64-variant ID ↔ shortcode conversion.
|
|
553
|
+
*/
|
|
554
|
+
/**
|
|
555
|
+
* Decode an Instagram shortcode into its numeric post ID.
|
|
556
|
+
*/
|
|
557
|
+
declare function idFromShortcode(shortcode: string): string;
|
|
558
|
+
/**
|
|
559
|
+
* Encode a numeric post ID into an Instagram shortcode.
|
|
560
|
+
*/
|
|
561
|
+
declare function shortcodeFromId(postId: string | number): string;
|
|
562
|
+
//#endregion
|
|
563
|
+
//#region src/utils/text.d.ts
|
|
564
|
+
/**
|
|
565
|
+
* Text utilities ported from gallery-dl's ``text`` module.
|
|
566
|
+
*
|
|
567
|
+
* All functions are pure and environment-agnostic.
|
|
568
|
+
*/
|
|
569
|
+
/** String extraction */
|
|
570
|
+
/**
|
|
571
|
+
* Extract the substring between ``begin`` and ``end`` from ``txt``.
|
|
572
|
+
* Returns the substring or ``null`` if either delimiter is missing.
|
|
573
|
+
*/
|
|
574
|
+
declare function extract(txt: string, begin: string, end: string): string | null;
|
|
575
|
+
/**
|
|
576
|
+
* Shorthand: same as ``extract`` but returns ``default_`` on failure.
|
|
577
|
+
* Mirrors the Python ``extr()`` function.
|
|
578
|
+
*/
|
|
579
|
+
declare function extr(txt: string, begin: string, end: string, default_?: string): string;
|
|
580
|
+
/** Unicode / HTML */
|
|
581
|
+
/**
|
|
582
|
+
* Decode ``\\uXXXX`` escape sequences in a string.
|
|
583
|
+
*/
|
|
584
|
+
declare function parseUnicodeEscapes(text: string): string;
|
|
585
|
+
declare function unescape(text: string): string;
|
|
586
|
+
/** URL helpers */
|
|
587
|
+
/**
|
|
588
|
+
* URL-decode a string.
|
|
589
|
+
*/
|
|
590
|
+
declare function unquote(text: string): string;
|
|
591
|
+
/**
|
|
592
|
+
* Ensure a URL starts with ``https://`` (or ``http://``).
|
|
593
|
+
*/
|
|
594
|
+
declare function ensureHttpScheme(url: string, scheme?: string): string;
|
|
595
|
+
/**
|
|
596
|
+
* Extract filename + extension from a URL and write into ``meta``.
|
|
597
|
+
*/
|
|
598
|
+
declare function nameExtFromURL(url: string, meta: Record<string, unknown>): void;
|
|
599
|
+
/**
|
|
600
|
+
* Parse an integer from a possibly-null value. Returns ``default_`` on failure.
|
|
601
|
+
*/
|
|
602
|
+
declare function parseInt(value: string | number | null | undefined, default_?: number): number;
|
|
603
|
+
/** Pre-configured hashtag regex. */
|
|
604
|
+
declare const findTags: (text: string) => string[];
|
|
736
605
|
//#endregion
|
|
737
|
-
export {
|
|
606
|
+
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 };
|