instasave-sdk 1.0.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 +21 -0
- package/README.md +153 -0
- package/dist/auth-fast.d.ts +32 -0
- package/dist/auth-fast.d.ts.map +1 -0
- package/dist/auth-fast.js +505 -0
- package/dist/auth-fast.js.map +1 -0
- package/dist/auth.d.ts +80 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +370 -0
- package/dist/auth.js.map +1 -0
- package/dist/benchmark.d.ts +48 -0
- package/dist/benchmark.d.ts.map +1 -0
- package/dist/benchmark.js +125 -0
- package/dist/benchmark.js.map +1 -0
- package/dist/health.d.ts +28 -0
- package/dist/health.d.ts.map +1 -0
- package/dist/health.js +108 -0
- package/dist/health.js.map +1 -0
- package/dist/index.d.ts +101 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +492 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +22 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +151 -0
- package/dist/logger.js.map +1 -0
- package/dist/memory.d.ts +56 -0
- package/dist/memory.d.ts.map +1 -0
- package/dist/memory.js +144 -0
- package/dist/memory.js.map +1 -0
- package/dist/metrics.d.ts +19 -0
- package/dist/metrics.d.ts.map +1 -0
- package/dist/metrics.js +79 -0
- package/dist/metrics.js.map +1 -0
- package/dist/parallel.d.ts +59 -0
- package/dist/parallel.d.ts.map +1 -0
- package/dist/parallel.js +202 -0
- package/dist/parallel.js.map +1 -0
- package/dist/platforms/index.d.ts +7 -0
- package/dist/platforms/index.d.ts.map +1 -0
- package/dist/platforms/index.js +13 -0
- package/dist/platforms/index.js.map +1 -0
- package/dist/platforms/instagram.d.ts +6 -0
- package/dist/platforms/instagram.d.ts.map +1 -0
- package/dist/platforms/instagram.js +189 -0
- package/dist/platforms/instagram.js.map +1 -0
- package/dist/plugins.d.ts +128 -0
- package/dist/plugins.d.ts.map +1 -0
- package/dist/plugins.js +107 -0
- package/dist/plugins.js.map +1 -0
- package/dist/test-integration.d.ts +2 -0
- package/dist/test-integration.d.ts.map +1 -0
- package/dist/test-integration.js +46 -0
- package/dist/test-integration.js.map +1 -0
- package/dist/types.d.ts +75 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/dist/worker.d.ts +2 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +23 -0
- package/dist/worker.js.map +1 -0
- package/package.json +56 -0
package/dist/plugins.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PluginManager = void 0;
|
|
4
|
+
const logger_1 = require("./logger");
|
|
5
|
+
/**
|
|
6
|
+
* Plugin manager for registering and managing plugins
|
|
7
|
+
*/
|
|
8
|
+
class PluginManager {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.plugins = new Map();
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Register a plugin
|
|
14
|
+
* @param plugin - Plugin to register
|
|
15
|
+
*/
|
|
16
|
+
register(plugin) {
|
|
17
|
+
if (this.plugins.has(plugin.name)) {
|
|
18
|
+
console.warn(`⚠️ Plugin "${plugin.name}" is already registered. Overwriting...`);
|
|
19
|
+
}
|
|
20
|
+
this.plugins.set(plugin.name, plugin);
|
|
21
|
+
logger_1.log.info(`✅ Registered ${plugin.type} plugin: ${plugin.name} v${plugin.version}`);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Unregister a plugin
|
|
25
|
+
* @param pluginName - Name of plugin to unregister
|
|
26
|
+
*/
|
|
27
|
+
unregister(pluginName) {
|
|
28
|
+
if (this.plugins.delete(pluginName)) {
|
|
29
|
+
logger_1.log.info(`✅ Unregistered plugin: ${pluginName}`);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
console.warn(`⚠️ Plugin "${pluginName}" not found`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Get platform plugin for a given URL
|
|
37
|
+
* @param url - URL to match against platform patterns
|
|
38
|
+
* @returns PlatformPlugin or null if no match
|
|
39
|
+
*/
|
|
40
|
+
getPlatformForUrl(url) {
|
|
41
|
+
for (const plugin of this.plugins.values()) {
|
|
42
|
+
if (plugin.type === 'platform' && plugin.validateUrl(url)) {
|
|
43
|
+
return plugin;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get all registered plugins
|
|
50
|
+
*/
|
|
51
|
+
getPlugins() {
|
|
52
|
+
return Array.from(this.plugins.values());
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get all platform plugins
|
|
56
|
+
*/
|
|
57
|
+
getPlatformPlugins() {
|
|
58
|
+
return this.getPlugins().filter(p => p.type === 'platform');
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get all utility plugins
|
|
62
|
+
*/
|
|
63
|
+
getUtilityPlugins() {
|
|
64
|
+
return this.getPlugins().filter(p => p.type === 'utility');
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Execute a lifecycle hook across all utility plugins
|
|
68
|
+
* @param hookName - Name of the hook to execute
|
|
69
|
+
* @param args - Arguments to pass to the hook
|
|
70
|
+
*/
|
|
71
|
+
async executeHook(hookName, ...args) {
|
|
72
|
+
const utilityPlugins = this.getUtilityPlugins();
|
|
73
|
+
let result = args[0]; // For hooks that transform data (like onAfterScrape)
|
|
74
|
+
for (const plugin of utilityPlugins) {
|
|
75
|
+
const hook = plugin.hooks[hookName];
|
|
76
|
+
if (hook) {
|
|
77
|
+
try {
|
|
78
|
+
// @ts-ignore - TypeScript struggles with this dynamic hook calling
|
|
79
|
+
const hookResult = await hook(...args);
|
|
80
|
+
// If hook returns a value, use it as input for next hook
|
|
81
|
+
if (hookResult !== undefined) {
|
|
82
|
+
result = hookResult;
|
|
83
|
+
args[0] = hookResult;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
logger_1.log.error(`❌ Error in plugin "${plugin.name}" hook "${hookName}":`, error);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return result;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Check if a plugin is registered
|
|
95
|
+
*/
|
|
96
|
+
hasPlugin(pluginName) {
|
|
97
|
+
return this.plugins.has(pluginName);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Get a specific plugin by name
|
|
101
|
+
*/
|
|
102
|
+
getPlugin(pluginName) {
|
|
103
|
+
return this.plugins.get(pluginName);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.PluginManager = PluginManager;
|
|
107
|
+
//# sourceMappingURL=plugins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../src/plugins.ts"],"names":[],"mappings":";;;AAAA,qCAA+B;AAmG/B;;GAEG;AACH,MAAa,aAAa;IAA1B;QACU,YAAO,GAAwB,IAAI,GAAG,EAAE,CAAC;IA4GnD,CAAC;IA1GC;;;OAGG;IACH,QAAQ,CAAC,MAAc;QACrB,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;YAClC,OAAO,CAAC,IAAI,CAAC,eAAe,MAAM,CAAC,IAAI,yCAAyC,CAAC,CAAC;QACpF,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACtC,YAAG,CAAC,IAAI,CAAC,gBAAgB,MAAM,CAAC,IAAI,YAAY,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IACpF,CAAC;IAED;;;OAGG;IACH,UAAU,C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ACpC,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YACpC,IAAI,IAAI,EAAE,CAAC;gBACT,IAAI,CAAC;oBACH,mEAAmE;oBACnE,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;oBAEvC,yDAAyD;oBACzD,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;wBAC7B,MAAM,GAAG,UAAU,CAAC;wBACpB,IAAI,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC;oBACvB,CAAC;gBACH,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,YAAG,CAAC,KAAK,CAAC,sBAAsB,MAAM,CAAC,IAAI,WAAW,QAAQ,IAAI,EAAE,KAAK,CAAC,CAAC;gBAC7E,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;OAEG;IACH,SAAS,CAAC,UAAkB;QAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACH,SAAS,CAAC,UAAkB;QAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC;CACF;AA7GD,sCA6GC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-integration.d.ts","sourceRoot":"","sources":["../src/test-integration.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const index_1 = require("./index");
|
|
4
|
+
async function testCarouselScraping() {
|
|
5
|
+
console.log('🧪 Starting integration test for carousel images...\n');
|
|
6
|
+
const scraper = new index_1.InstaScraper();
|
|
7
|
+
const testUrl = 'https://www.instagram.com/p/DS1nm0hiFdH/';
|
|
8
|
+
try {
|
|
9
|
+
console.log(`📱 Scraping: ${testUrl}`);
|
|
10
|
+
const data = await scraper.scrapePost(testUrl, {
|
|
11
|
+
headless: true,
|
|
12
|
+
timeout: 120,
|
|
13
|
+
saveToFile: false
|
|
14
|
+
});
|
|
15
|
+
console.log('\n✅ Integration test PASSED!');
|
|
16
|
+
console.log('📊 Results:');
|
|
17
|
+
console.log(` Post ID: ${data.post_id}`);
|
|
18
|
+
console.log(` Profile: ${data.profile_name}`);
|
|
19
|
+
console.log(` Media items found: ${data.media.length}`);
|
|
20
|
+
console.log(` URL: ${data.url}`);
|
|
21
|
+
console.log(` Likes: ${data.metadata.likesCount || 'N/A'}`);
|
|
22
|
+
console.log(` Comments: ${data.metadata.commentsCount || 'N/A'}`);
|
|
23
|
+
console.log(` Caption: ${data.metadata.caption?.substring(0, 50) || 'N/A'}...`);
|
|
24
|
+
if (data.media.length > 0) {
|
|
25
|
+
console.log('\n🖼️ Media items:');
|
|
26
|
+
data.media.forEach((item) => {
|
|
27
|
+
console.log(` ${item.index + 1}. ${item.url.substring(0, 80)}...`);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
// Validate results
|
|
31
|
+
if (data.post_id !== 'DS1nm0hiFdH') {
|
|
32
|
+
throw new Error(`Expected post_id 'DS1nm0hiFdH', got '${data.post_id}'`);
|
|
33
|
+
}
|
|
34
|
+
if (data.media.length === 0) {
|
|
35
|
+
throw new Error('No media items found');
|
|
36
|
+
}
|
|
37
|
+
console.log('\n🎉 All assertions passed!');
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
console.error('\n❌ Integration test FAILED:');
|
|
41
|
+
console.error(error.message);
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
testCarouselScraping();
|
|
46
|
+
//# sourceMappingURL=test-integration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-integration.js","sourceRoot":"","sources":["../src/test-integration.ts"],"names":[],"mappings":";;AAAA,mCAAuC;A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C,GAAG,CAAC,qBAAqB,CAAC,CAAC;YACnC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;gBACxB,OAAO,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,KAAK,GAAG,CAAC,KAAK,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;YACzE,CAAC,CAAC,CAAC;QACP,CAAC;QAED,mBAAmB;QACnB,IAAI,IAAI,CAAC,OAAO,KAAK,aAAa,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,wCAAwC,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;QAC7E,CAAC;QAED,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAC5C,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;IAE/C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAC9C,OAAO,CAAC,KAAK,CAAE,KAAe,CAAC,OAAO,CAAC,CAAC;QACxC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;AACL,CAAC;AAED,oBAAoB,EAAE,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Universal types for multi-platform media scraping
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Extended metadata for posts across all platforms
|
|
6
|
+
*/
|
|
7
|
+
export interface PostMetadata {
|
|
8
|
+
/** Number of likes/reactions */
|
|
9
|
+
likesCount: number | null;
|
|
10
|
+
/** Number of comments */
|
|
11
|
+
commentsCount: number | null;
|
|
12
|
+
/** Post caption/description */
|
|
13
|
+
caption: string | null;
|
|
14
|
+
/** Extracted hashtags from caption */
|
|
15
|
+
hashtags: string[];
|
|
16
|
+
/** Mentioned users in caption */
|
|
17
|
+
mentions: string[];
|
|
18
|
+
/** Post creation timestamp (ISO 8601) */
|
|
19
|
+
timestamp: string | null;
|
|
20
|
+
/** Location/place name if available */
|
|
21
|
+
location: string | null;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Media item in a carousel/gallery
|
|
25
|
+
*/
|
|
26
|
+
export interface CarouselItem {
|
|
27
|
+
/** Position in carousel (0-indexed) */
|
|
28
|
+
index: number;
|
|
29
|
+
/** Media URL */
|
|
30
|
+
url: string;
|
|
31
|
+
/** Image width in pixels */
|
|
32
|
+
width?: number;
|
|
33
|
+
/** Image height in pixels */
|
|
34
|
+
height?: number;
|
|
35
|
+
/** Alt text for accessibility */
|
|
36
|
+
altText?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Instagram post data structure (backward compatible)
|
|
40
|
+
*/
|
|
41
|
+
export interface InstagramPostData {
|
|
42
|
+
/** Original post URL */
|
|
43
|
+
url: string;
|
|
44
|
+
/** Unique post identifier */
|
|
45
|
+
post_id: string;
|
|
46
|
+
/** Instagram profile username */
|
|
47
|
+
profile_name: string;
|
|
48
|
+
/** Media items with carousel indexing */
|
|
49
|
+
media: CarouselItem[];
|
|
50
|
+
/** Extended metadata */
|
|
51
|
+
metadata: PostMetadata;
|
|
52
|
+
/**
|
|
53
|
+
* @deprecated Use `media` instead. This property is kept for backward compatibility.
|
|
54
|
+
* Returns array of image URLs extracted from media items.
|
|
55
|
+
*/
|
|
56
|
+
images?: string[];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Universal media data for all platforms
|
|
60
|
+
*/
|
|
61
|
+
export interface MediaData {
|
|
62
|
+
/** Original post URL */
|
|
63
|
+
url: string;
|
|
64
|
+
/** Unique post identifier */
|
|
65
|
+
post_id: string;
|
|
66
|
+
/** Platform name */
|
|
67
|
+
platform: string;
|
|
68
|
+
/** Profile/channel/user name */
|
|
69
|
+
profile_name: string;
|
|
70
|
+
/** Media items */
|
|
71
|
+
media: CarouselItem[];
|
|
72
|
+
/** Extended metadata */
|
|
73
|
+
metadata: PostMetadata;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,gCAAgC;IAChC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,yBAAyB;IACzB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,+BAA+B;IAC/B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,sCAAsC;IACtC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,iCAAiC;IACjC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,yCAAyC;IACzC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,uCAAuC;IACvC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,4BAA4B;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6BAA6B;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,wBAAwB;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,iCAAiC;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,yCAAyC;IACzC,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,wBAAwB;IACxB,QAAQ,EAAE,YAAY,CAAC;IAEvB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,wBAAwB;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,gCAAgC;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB;IAClB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,wBAAwB;IACxB,QAAQ,EAAE,YAAY,CAAC;CACxB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;GAEG"}
|
package/dist/worker.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../src/worker.js"],"names":[],"mappings":""}
|
package/dist/worker.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const { parentPort } = require('worker_threads');
|
|
3
|
+
const { InstaScraper } = require('./index');
|
|
4
|
+
// Worker thread for parallel processing
|
|
5
|
+
parentPort.on('message', async ({ taskId, url, options }) => {
|
|
6
|
+
try {
|
|
7
|
+
const scraper = new InstaScraper();
|
|
8
|
+
const result = await scraper.scrapePost(url, options);
|
|
9
|
+
parentPort.postMessage({
|
|
10
|
+
taskId,
|
|
11
|
+
type: 'success',
|
|
12
|
+
data: result
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
parentPort.postMessage({
|
|
17
|
+
taskId,
|
|
18
|
+
type: 'error',
|
|
19
|
+
error: error.message
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../src/worker.js"],"names":[],"mappings":";AAAA,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AACjD,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAE5C,wCAAwC;AACxC,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE;IAC1D,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,YAAY,EAAE,CAAC;QACnC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAEtD,UAAU,CAAC,WAAW,CAAC;YACrB,MAAM;YACN,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,MAAM;SACb,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,UAAU,CAAC,WAAW,CAAC;YACrB,MAAM;YACN,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,KAAK,CAAC,OAAO;SACrB,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "instasave-sdk",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Instagram image scraper SDK with authentication support",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/nykadamec/instasave-sdk.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/nykadamec/instasave-sdk#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/nykadamec/instasave-sdk/issues"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc",
|
|
17
|
+
"dev": "tsc --watch",
|
|
18
|
+
"test": "jest",
|
|
19
|
+
"test:watch": "jest --watch",
|
|
20
|
+
"test:integration": "node dist/test-integration.js",
|
|
21
|
+
"prepublishOnly": "npm run build"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist/",
|
|
25
|
+
"README.md",
|
|
26
|
+
"LICENSE"
|
|
27
|
+
],
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"playwright": "^1.40.0",
|
|
30
|
+
"crawlee": "^3.5.0",
|
|
31
|
+
"puppeteer": "^21.0.0",
|
|
32
|
+
"dotenv": "^16.0.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"typescript": "^5.0.0",
|
|
36
|
+
"@types/node": "^20.0.0",
|
|
37
|
+
"jest": "^29.0.0",
|
|
38
|
+
"@types/jest": "^29.0.0",
|
|
39
|
+
"ts-jest": "^29.0.0"
|
|
40
|
+
},
|
|
41
|
+
"keywords": [
|
|
42
|
+
"instagram",
|
|
43
|
+
"scraper",
|
|
44
|
+
"images",
|
|
45
|
+
"photos",
|
|
46
|
+
"downloader",
|
|
47
|
+
"playwright",
|
|
48
|
+
"crawlee",
|
|
49
|
+
"sdk"
|
|
50
|
+
],
|
|
51
|
+
"author": "nykadamec",
|
|
52
|
+
"license": "MIT",
|
|
53
|
+
"engines": {
|
|
54
|
+
"node": ">=16.0.0"
|
|
55
|
+
}
|
|
56
|
+
}
|