@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
package/dist/index.mjs
CHANGED
|
@@ -1,40 +1,154 @@
|
|
|
1
|
-
import { a as
|
|
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
|
-
|
|
1
|
+
import { A as directory, B as _YELLOW, C as extract, D as parseUnicodeEscapes, E as parseInt, F as Extractor, G as pad, H as c, I as noopLogger, K as ConfigManager, L as DownloadJob, M as url, N as idFromShortcode, O as unescape, P as shortcodeFromId, R as Job, S as extr, T as nameExtFromURL, U as dim, V as b, W as g, _ as extractAudio, a as InstagramTaggedExtractor, b as InstagramRestAPI, c as InstagramSavedExtractor, d as InstagramPostExtractor, f as InstagramInfoExtractor, g as parsePostGraphql, h as InstagramExtractor, i as InstagramUserExtractor, j as queue, k as unquote, l as InstagramReelsExtractor, m as InstagramAvatarExtractor, o as InstagramTagExtractor, p as InstagramHighlightsExtractor, s as InstagramStoriesExtractor, t as InstagramSDK, u as InstagramPostsExtractor, v as extractTaggedUsers, w as findTags, x as ensureHttpScheme, y as parsePostRest, z as _RESET } from "./sdk-CovBsEps.mjs";
|
|
2
|
+
//#region src/core/print-job.ts
|
|
3
|
+
var PrintJob = class PrintJob extends Job {
|
|
4
|
+
_currentDir = {};
|
|
5
|
+
_files = [];
|
|
6
|
+
_postCount = 0;
|
|
7
|
+
_fileCount = 0;
|
|
8
|
+
_width;
|
|
9
|
+
constructor(extractor) {
|
|
10
|
+
super(extractor);
|
|
11
|
+
this._width = Math.min(process.stdout.columns ?? 80, 100);
|
|
12
|
+
}
|
|
13
|
+
async handleDirectory(msg) {
|
|
14
|
+
if (this._postCount > 0) this._flushPost();
|
|
15
|
+
this._currentDir = { ...msg.metadata };
|
|
16
|
+
this._postCount++;
|
|
17
|
+
this._files = [];
|
|
18
|
+
}
|
|
19
|
+
async handleUrl(msg) {
|
|
20
|
+
const meta = {
|
|
21
|
+
...this._currentDir,
|
|
22
|
+
...msg.metadata
|
|
23
|
+
};
|
|
24
|
+
this._fileCount++;
|
|
25
|
+
const ext = meta.extension ?? "jpg";
|
|
26
|
+
const mid = meta.media_id ?? "?";
|
|
27
|
+
this._files.push({
|
|
28
|
+
num: meta.num ?? this._files.length + 1,
|
|
29
|
+
filename: `${mid}.${ext}`,
|
|
30
|
+
width: meta.width ?? 0,
|
|
31
|
+
height: meta.height ?? 0,
|
|
32
|
+
videoUrl: meta.video_url ?? null,
|
|
33
|
+
audioUrl: meta.audio_url ?? null
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
async handleQueue(msg) {
|
|
37
|
+
if (this._files.length > 0 || this._postCount > 0) this._flushPost();
|
|
38
|
+
this._postCount = 0;
|
|
39
|
+
this._files = [];
|
|
40
|
+
const extrClass = {
|
|
41
|
+
...this._currentDir,
|
|
42
|
+
...msg.metadata
|
|
43
|
+
}._extractor;
|
|
44
|
+
if (!extrClass || typeof extrClass !== "object") return;
|
|
45
|
+
const cls = extrClass;
|
|
46
|
+
const match = cls.pattern.exec(msg.url);
|
|
47
|
+
if (!match) return;
|
|
48
|
+
const parentExtr = this.extractor;
|
|
49
|
+
const childJob = new PrintJob(Reflect.construct(cls, [{
|
|
50
|
+
url: msg.url,
|
|
51
|
+
match,
|
|
52
|
+
config: parentExtr.config,
|
|
53
|
+
http: parentExtr.http,
|
|
54
|
+
storage: parentExtr.storage,
|
|
55
|
+
log: parentExtr.log
|
|
56
|
+
}]));
|
|
57
|
+
const childStatus = await childJob.run();
|
|
58
|
+
this.status |= childStatus;
|
|
59
|
+
this._postCount += childJob._postCount;
|
|
60
|
+
this._fileCount += childJob._fileCount;
|
|
61
|
+
}
|
|
62
|
+
_flushPost() {
|
|
63
|
+
const m = this._currentDir;
|
|
64
|
+
if (Object.keys(m).length === 0) return;
|
|
65
|
+
const w = this._width;
|
|
66
|
+
const labelW = 14;
|
|
67
|
+
const shortcode = m.post_shortcode ?? "?";
|
|
68
|
+
const header = ` Post #${this._postCount}: ${shortcode} `;
|
|
69
|
+
const padTotal = w - 2 - header.length;
|
|
70
|
+
const padL = Math.floor(padTotal / 2);
|
|
71
|
+
const padR = padTotal - padL;
|
|
72
|
+
process.stdout.write(`\n${dim("┌")}${"─".repeat(padL)}${b(header)}${"─".repeat(padR)}${dim("┐")}\n`);
|
|
73
|
+
const row = (label, value, color) => {
|
|
74
|
+
const colored = typeof color === "function" ? color(value) : color ? `${color}${value}${_RESET}` : value;
|
|
75
|
+
process.stdout.write(` ${dim("│")} ${c(pad(label, labelW))} ${colored}\n`);
|
|
76
|
+
};
|
|
77
|
+
const username = m.username ?? "?";
|
|
78
|
+
const fullname = m.fullname ?? "";
|
|
79
|
+
row("Author:", fullname ? `${username} (${fullname})` : username, g);
|
|
80
|
+
row("Date:", m.date ?? m.post_date ?? "?");
|
|
81
|
+
row("Likes:", `${typeof m.likes === "number" ? m.likes.toLocaleString() : "?"} | Liked: ${m.liked ? "yes" : "no"}`);
|
|
82
|
+
row("Type:", `${m.type ?? "?"} (${this._files.length} files)`);
|
|
83
|
+
row("URL:", m.post_url ?? "?");
|
|
84
|
+
const desc = m.description ?? "";
|
|
85
|
+
if (desc) {
|
|
86
|
+
process.stdout.write(` ${dim("│")}\n`);
|
|
87
|
+
process.stdout.write(` ${dim("│")} ${b("Description:")}\n`);
|
|
88
|
+
for (const line of desc.split("\n")) for (const wl of this._wrap(line, w - 8)) process.stdout.write(` ${dim("│")} ${dim(wl)}\n`);
|
|
89
|
+
}
|
|
90
|
+
const tags = m.tags;
|
|
91
|
+
if (tags && tags.length > 0) {
|
|
92
|
+
process.stdout.write(` ${dim("│")}\n`);
|
|
93
|
+
process.stdout.write(` ${dim("│")} ${b("Tags:")} ${dim(tags.map((t) => `#${t}`).join(" "))}\n`);
|
|
94
|
+
}
|
|
95
|
+
const locName = m.location_slug ?? "";
|
|
96
|
+
const locId = m.location_id ?? "";
|
|
97
|
+
if (locName || locId) row("Location:", locId ? `${locName} (ID: ${locId})` : locName);
|
|
98
|
+
const coauthors = m.coauthors;
|
|
99
|
+
if (coauthors && coauthors.length > 0) row("Co-authors:", coauthors.map((c) => c.full_name ? `${c.username} (${c.full_name})` : c.username).join(", "));
|
|
100
|
+
const pinned = m.pinned;
|
|
101
|
+
if (pinned && pinned.length > 0) row("Pinned:", pinned.join(", "));
|
|
102
|
+
const expires = m.expires;
|
|
103
|
+
if (expires) row("Expires:", expires, _YELLOW);
|
|
104
|
+
const hlTitle = m.highlight_title;
|
|
105
|
+
if (hlTitle) row("Highlight:", hlTitle);
|
|
106
|
+
const taggedUser = m.tagged_username ?? "";
|
|
107
|
+
if (taggedUser) {
|
|
108
|
+
const taggedFull = m.tagged_full_name ?? "";
|
|
109
|
+
row("Tagged by:", taggedFull ? `${taggedUser} (${taggedFull})` : taggedUser);
|
|
110
|
+
}
|
|
111
|
+
if (this._files.length > 0) {
|
|
112
|
+
process.stdout.write(` ${dim("│")}\n`);
|
|
113
|
+
process.stdout.write(` ${dim("│")} ${b(`Media (${this._files.length} files):`)}\n`);
|
|
114
|
+
const maxNumW = String(this._files.length).length;
|
|
115
|
+
const maxFileW = Math.max(...this._files.map((f) => f.filename.length));
|
|
116
|
+
const dimW = Math.min(maxFileW, 40);
|
|
117
|
+
for (const f of this._files) {
|
|
118
|
+
const numStr = `[${String(f.num).padStart(maxNumW)}]`;
|
|
119
|
+
const dimStr = f.filename.length > 40 ? `${f.filename.slice(0, 37)}...` : pad(f.filename, dimW);
|
|
120
|
+
const res = f.width ? `${f.width}x${f.height}` : "?x?";
|
|
121
|
+
const badges = [];
|
|
122
|
+
if (f.videoUrl) badges.push("video");
|
|
123
|
+
if (f.audioUrl) badges.push("audio");
|
|
124
|
+
let line = ` ${dim("│")} ${g(numStr)} ${dimStr} ${res}`;
|
|
125
|
+
if (badges.length > 0) line += ` ${_YELLOW}(${badges.join("+")})${_RESET}`;
|
|
126
|
+
process.stdout.write(`${line}\n`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
process.stdout.write(` ${dim("└")}${"─".repeat(w - 2)}${dim("┘")}\n`);
|
|
130
|
+
}
|
|
131
|
+
_wrap(text, maxLen) {
|
|
132
|
+
if (text.length <= maxLen) return [text];
|
|
133
|
+
const lines = [];
|
|
134
|
+
let remaining = text;
|
|
135
|
+
while (remaining.length > maxLen) {
|
|
136
|
+
let cut = maxLen;
|
|
137
|
+
while (cut > 0 && remaining[cut] !== " ") cut--;
|
|
138
|
+
if (cut === 0) cut = maxLen;
|
|
139
|
+
lines.push(remaining.slice(0, cut).trimEnd());
|
|
140
|
+
remaining = remaining.slice(cut).trimStart();
|
|
141
|
+
}
|
|
142
|
+
if (remaining) lines.push(remaining);
|
|
143
|
+
return lines;
|
|
144
|
+
}
|
|
145
|
+
_report() {
|
|
146
|
+
this._flushPost();
|
|
147
|
+
process.stdout.write(`\n${dim("──")} ${b("Summary")} ${dim("───")}\n`);
|
|
148
|
+
process.stdout.write(` Posts: ${g(String(this._postCount))}\n`);
|
|
149
|
+
process.stdout.write(` Files: ${g(String(this._fileCount))}\n`);
|
|
150
|
+
process.stdout.write(`\n`);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
39
153
|
//#endregion
|
|
40
|
-
export { ConfigManager, DownloadJob, Extractor, InstagramAvatarExtractor, InstagramExtractor, InstagramHighlightsExtractor, InstagramInfoExtractor, InstagramPostExtractor, InstagramPostsExtractor, InstagramReelsExtractor, InstagramRestAPI, InstagramSDK, InstagramSavedExtractor, InstagramStoriesExtractor, InstagramTagExtractor, InstagramTaggedExtractor, InstagramUserExtractor, Job, PrintJob,
|
|
154
|
+
export { ConfigManager, DownloadJob, Extractor, InstagramAvatarExtractor, InstagramExtractor, InstagramHighlightsExtractor, InstagramInfoExtractor, InstagramPostExtractor, InstagramPostsExtractor, InstagramReelsExtractor, InstagramRestAPI, InstagramSDK, InstagramSavedExtractor, InstagramStoriesExtractor, InstagramTagExtractor, InstagramTaggedExtractor, InstagramUserExtractor, Job, PrintJob, directory, ensureHttpScheme, extr, extract, extractAudio, extractTaggedUsers, findTags, idFromShortcode, nameExtFromURL, noopLogger, parseInt, parsePostGraphql, parsePostRest, parseUnicodeEscapes, queue, shortcodeFromId, unescape, unquote, url };
|
package/dist/node.cjs
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_sdk = require("./sdk-BClg0Kv2.cjs");
|
|
3
|
+
//#region src/node-factory.ts
|
|
4
|
+
/**
|
|
5
|
+
* Create an SDK instance with Node.js defaults.
|
|
6
|
+
*
|
|
7
|
+
* When ``cookies`` is provided, auto-creates a native-fetch HttpClient
|
|
8
|
+
* with CSRF token extraction. Pass ``http`` directly for custom adapters.
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { createSDK } from '@chilfish/gallery-dl-instagram/node'
|
|
12
|
+
*
|
|
13
|
+
* // Node.js with cookies
|
|
14
|
+
* const ig = await createSDK({ cookies: 'ds_user_id=...; sessionid=...' })
|
|
15
|
+
*
|
|
16
|
+
* // Custom http adapter (browser / Deno / Edge)
|
|
17
|
+
* const ig = await createSDK({ http: myHttpClient, storage: myStorage })
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
async function createSDK(opts = {}) {
|
|
21
|
+
const log = opts.log ?? require_sdk.noopLogger;
|
|
22
|
+
let http = opts.http;
|
|
23
|
+
let storage = opts.storage;
|
|
24
|
+
let csrfToken = "";
|
|
25
|
+
if (!http && opts.cookies) {
|
|
26
|
+
csrfToken = require_sdk.extractCsrf(opts.cookies);
|
|
27
|
+
http = require_sdk.createFetchHttpClient({ cookie: opts.cookies });
|
|
28
|
+
if (!storage) {
|
|
29
|
+
const { createStorage } = await Promise.resolve().then(() => require("./storage-BwGaT6XO.cjs"));
|
|
30
|
+
storage = createStorage();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return new require_sdk.InstagramSDK({
|
|
34
|
+
http,
|
|
35
|
+
storage,
|
|
36
|
+
log,
|
|
37
|
+
csrfToken
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
exports.createSDK = createSDK;
|
package/dist/node.d.cts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { b as Storage, n as InstagramSDK, o as Logger, p as HttpClient } from "./sdk-DyZz22bT.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/node-factory.d.ts
|
|
4
|
+
/** Options for the Node.js convenience factory. */
|
|
5
|
+
interface CreateSDKOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Full browser Cookie header string.
|
|
8
|
+
* Copy from DevTools → Network → Request Headers → Cookie.
|
|
9
|
+
* Auto-extracts csrftoken for X-CSRFToken header.
|
|
10
|
+
*
|
|
11
|
+
* Either ``cookies`` or ``http`` must be provided.
|
|
12
|
+
*/
|
|
13
|
+
cookies?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Custom HttpClient implementation.
|
|
16
|
+
* If omitted, a Node.js native-fetch client is created from ``cookies``.
|
|
17
|
+
*/
|
|
18
|
+
http?: HttpClient;
|
|
19
|
+
/**
|
|
20
|
+
* Custom Storage implementation for file output.
|
|
21
|
+
* Defaults to Node.js fs/promises-based storage.
|
|
22
|
+
*/
|
|
23
|
+
storage?: Storage;
|
|
24
|
+
/**
|
|
25
|
+
* Logger instance. Defaults to a silent no-op logger.
|
|
26
|
+
*/
|
|
27
|
+
log?: Logger;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Create an SDK instance with Node.js defaults.
|
|
31
|
+
*
|
|
32
|
+
* When ``cookies`` is provided, auto-creates a native-fetch HttpClient
|
|
33
|
+
* with CSRF token extraction. Pass ``http`` directly for custom adapters.
|
|
34
|
+
*
|
|
35
|
+
* ```ts
|
|
36
|
+
* import { createSDK } from '@chilfish/gallery-dl-instagram/node'
|
|
37
|
+
*
|
|
38
|
+
* // Node.js with cookies
|
|
39
|
+
* const ig = await createSDK({ cookies: 'ds_user_id=...; sessionid=...' })
|
|
40
|
+
*
|
|
41
|
+
* // Custom http adapter (browser / Deno / Edge)
|
|
42
|
+
* const ig = await createSDK({ http: myHttpClient, storage: myStorage })
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
declare function createSDK(opts?: CreateSDKOptions): Promise<InstagramSDK>;
|
|
46
|
+
//#endregion
|
|
47
|
+
export { type CreateSDKOptions, createSDK };
|
package/dist/node.d.mts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { b as Storage, n as InstagramSDK, o as Logger, p as HttpClient } from "./sdk-DyZz22bT.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/node-factory.d.ts
|
|
4
|
+
/** Options for the Node.js convenience factory. */
|
|
5
|
+
interface CreateSDKOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Full browser Cookie header string.
|
|
8
|
+
* Copy from DevTools → Network → Request Headers → Cookie.
|
|
9
|
+
* Auto-extracts csrftoken for X-CSRFToken header.
|
|
10
|
+
*
|
|
11
|
+
* Either ``cookies`` or ``http`` must be provided.
|
|
12
|
+
*/
|
|
13
|
+
cookies?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Custom HttpClient implementation.
|
|
16
|
+
* If omitted, a Node.js native-fetch client is created from ``cookies``.
|
|
17
|
+
*/
|
|
18
|
+
http?: HttpClient;
|
|
19
|
+
/**
|
|
20
|
+
* Custom Storage implementation for file output.
|
|
21
|
+
* Defaults to Node.js fs/promises-based storage.
|
|
22
|
+
*/
|
|
23
|
+
storage?: Storage;
|
|
24
|
+
/**
|
|
25
|
+
* Logger instance. Defaults to a silent no-op logger.
|
|
26
|
+
*/
|
|
27
|
+
log?: Logger;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Create an SDK instance with Node.js defaults.
|
|
31
|
+
*
|
|
32
|
+
* When ``cookies`` is provided, auto-creates a native-fetch HttpClient
|
|
33
|
+
* with CSRF token extraction. Pass ``http`` directly for custom adapters.
|
|
34
|
+
*
|
|
35
|
+
* ```ts
|
|
36
|
+
* import { createSDK } from '@chilfish/gallery-dl-instagram/node'
|
|
37
|
+
*
|
|
38
|
+
* // Node.js with cookies
|
|
39
|
+
* const ig = await createSDK({ cookies: 'ds_user_id=...; sessionid=...' })
|
|
40
|
+
*
|
|
41
|
+
* // Custom http adapter (browser / Deno / Edge)
|
|
42
|
+
* const ig = await createSDK({ http: myHttpClient, storage: myStorage })
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
declare function createSDK(opts?: CreateSDKOptions): Promise<InstagramSDK>;
|
|
46
|
+
//#endregion
|
|
47
|
+
export { type CreateSDKOptions, createSDK };
|
package/dist/node.mjs
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { I as noopLogger, n as createFetchHttpClient, r as extractCsrf, t as InstagramSDK } from "./sdk-CovBsEps.mjs";
|
|
2
|
+
//#region src/node-factory.ts
|
|
3
|
+
/**
|
|
4
|
+
* Create an SDK instance with Node.js defaults.
|
|
5
|
+
*
|
|
6
|
+
* When ``cookies`` is provided, auto-creates a native-fetch HttpClient
|
|
7
|
+
* with CSRF token extraction. Pass ``http`` directly for custom adapters.
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { createSDK } from '@chilfish/gallery-dl-instagram/node'
|
|
11
|
+
*
|
|
12
|
+
* // Node.js with cookies
|
|
13
|
+
* const ig = await createSDK({ cookies: 'ds_user_id=...; sessionid=...' })
|
|
14
|
+
*
|
|
15
|
+
* // Custom http adapter (browser / Deno / Edge)
|
|
16
|
+
* const ig = await createSDK({ http: myHttpClient, storage: myStorage })
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
async function createSDK(opts = {}) {
|
|
20
|
+
const log = opts.log ?? noopLogger;
|
|
21
|
+
let http = opts.http;
|
|
22
|
+
let storage = opts.storage;
|
|
23
|
+
let csrfToken = "";
|
|
24
|
+
if (!http && opts.cookies) {
|
|
25
|
+
csrfToken = extractCsrf(opts.cookies);
|
|
26
|
+
http = createFetchHttpClient({ cookie: opts.cookies });
|
|
27
|
+
if (!storage) {
|
|
28
|
+
const { createStorage } = await import("./storage-77hqz5Fi.mjs");
|
|
29
|
+
storage = createStorage();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return new InstagramSDK({
|
|
33
|
+
http,
|
|
34
|
+
storage,
|
|
35
|
+
log,
|
|
36
|
+
csrfToken
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { createSDK };
|