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.
Files changed (63) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +153 -0
  3. package/dist/auth-fast.d.ts +32 -0
  4. package/dist/auth-fast.d.ts.map +1 -0
  5. package/dist/auth-fast.js +505 -0
  6. package/dist/auth-fast.js.map +1 -0
  7. package/dist/auth.d.ts +80 -0
  8. package/dist/auth.d.ts.map +1 -0
  9. package/dist/auth.js +370 -0
  10. package/dist/auth.js.map +1 -0
  11. package/dist/benchmark.d.ts +48 -0
  12. package/dist/benchmark.d.ts.map +1 -0
  13. package/dist/benchmark.js +125 -0
  14. package/dist/benchmark.js.map +1 -0
  15. package/dist/health.d.ts +28 -0
  16. package/dist/health.d.ts.map +1 -0
  17. package/dist/health.js +108 -0
  18. package/dist/health.js.map +1 -0
  19. package/dist/index.d.ts +101 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +492 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/logger.d.ts +22 -0
  24. package/dist/logger.d.ts.map +1 -0
  25. package/dist/logger.js +151 -0
  26. package/dist/logger.js.map +1 -0
  27. package/dist/memory.d.ts +56 -0
  28. package/dist/memory.d.ts.map +1 -0
  29. package/dist/memory.js +144 -0
  30. package/dist/memory.js.map +1 -0
  31. package/dist/metrics.d.ts +19 -0
  32. package/dist/metrics.d.ts.map +1 -0
  33. package/dist/metrics.js +79 -0
  34. package/dist/metrics.js.map +1 -0
  35. package/dist/parallel.d.ts +59 -0
  36. package/dist/parallel.d.ts.map +1 -0
  37. package/dist/parallel.js +202 -0
  38. package/dist/parallel.js.map +1 -0
  39. package/dist/platforms/index.d.ts +7 -0
  40. package/dist/platforms/index.d.ts.map +1 -0
  41. package/dist/platforms/index.js +13 -0
  42. package/dist/platforms/index.js.map +1 -0
  43. package/dist/platforms/instagram.d.ts +6 -0
  44. package/dist/platforms/instagram.d.ts.map +1 -0
  45. package/dist/platforms/instagram.js +189 -0
  46. package/dist/platforms/instagram.js.map +1 -0
  47. package/dist/plugins.d.ts +128 -0
  48. package/dist/plugins.d.ts.map +1 -0
  49. package/dist/plugins.js +107 -0
  50. package/dist/plugins.js.map +1 -0
  51. package/dist/test-integration.d.ts +2 -0
  52. package/dist/test-integration.d.ts.map +1 -0
  53. package/dist/test-integration.js +46 -0
  54. package/dist/test-integration.js.map +1 -0
  55. package/dist/types.d.ts +75 -0
  56. package/dist/types.d.ts.map +1 -0
  57. package/dist/types.js +6 -0
  58. package/dist/types.js.map +1 -0
  59. package/dist/worker.d.ts +2 -0
  60. package/dist/worker.d.ts.map +1 -0
  61. package/dist/worker.js +23 -0
  62. package/dist/worker.js.map +1 -0
  63. package/package.json +56 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 nykadamec
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,153 @@
1
+ # InstaSave SDK
2
+
3
+ 📸 Simple Instagram scraper for downloading images from posts
4
+
5
+ ## What does it do?
6
+
7
+ InstaSave SDK allows you to download images from Instagram posts with just a few lines of code. Works with both public and private posts (after login).
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install instasave-sdk
13
+ ```
14
+
15
+ ## Basic Usage
16
+
17
+ ### 1. Download public post
18
+
19
+ ```javascript
20
+ import { InstaScraper } from 'instasave-sdk';
21
+
22
+ const scraper = new InstaScraper();
23
+
24
+ // Download images from Instagram post
25
+ const data = await scraper.scrapePost('https://www.instagram.com/p/ABC123/');
26
+
27
+ console.log(data);
28
+ // Result:
29
+ // {
30
+ // url: 'https://www.instagram.com/p/ABC123/',
31
+ // post_id: 'ABC123',
32
+ // profile_name: 'username',
33
+ // images: [
34
+ // 'https://instagram.com/image1.jpg',
35
+ // 'https://instagram.com/image2.jpg'
36
+ // ]
37
+ // }
38
+ ```
39
+
40
+ ### 2. Save to file
41
+
42
+ ```javascript
43
+ const data = await scraper.scrapePost('https://www.instagram.com/p/ABC123/', {
44
+ saveToFile: true, // Save data to JSON file
45
+ outputPath: './downloads' // Folder to save to
46
+ });
47
+ ```
48
+
49
+ ### 3. Access private posts
50
+
51
+ ```javascript
52
+ // Login first
53
+ await scraper.login({
54
+ username: 'your_username',
55
+ password: 'your_password'
56
+ });
57
+
58
+ // Then you can download private posts
59
+ const data = await scraper.scrapePost('https://www.instagram.com/p/private_post/');
60
+ ```
61
+
62
+ ## What SDK supports
63
+
64
+ ✅ **Single posts** - One image
65
+ ✅ **Carousel posts** - Multiple images in one post
66
+ ✅ **Private posts** - After login
67
+ ✅ **Auto save** - To JSON file
68
+ ✅ **Error handling** - When something fails
69
+
70
+ ❌ **Videos/Reels** - Images only
71
+ ❌ **Stories** - Posts only
72
+
73
+ ## All options
74
+
75
+ ```javascript
76
+ const data = await scraper.scrapePost('URL', {
77
+ saveToFile: true, // Save to file? (default: false)
78
+ outputPath: './folder', // Where to save? (default: current folder)
79
+ timeout: 60, // Timeout in seconds (default: 60)
80
+ retries: 2, // How many retries on error (default: 0)
81
+ headless: true // Hidden browser? (default: true)
82
+ });
83
+ ```
84
+
85
+ ## Common errors and solutions
86
+
87
+ ### "Login required"
88
+ ```javascript
89
+ // Solution: Login before downloading
90
+ await scraper.login({ username: 'user', password: 'pass' });
91
+ ```
92
+
93
+ ### "Failed to extract post ID"
94
+ ```javascript
95
+ // Solution: Check URL - must contain /p/
96
+ // ✅ Correct: https://www.instagram.com/p/ABC123/
97
+ // ❌ Wrong: https://www.instagram.com/username/
98
+ ```
99
+
100
+ ### "Timeout"
101
+ ```javascript
102
+ // Solution: Increase timeout
103
+ const data = await scraper.scrapePost(url, { timeout: 120 });
104
+ ```
105
+
106
+ ## Complete example
107
+
108
+ ```javascript
109
+ import { InstaScraper } from 'instasave-sdk';
110
+
111
+ async function downloadInstagramPost() {
112
+ const scraper = new InstaScraper();
113
+
114
+ try {
115
+ // Optionally login for private posts
116
+ // await scraper.login({
117
+ // username: 'your_username',
118
+ // password: 'your_password'
119
+ // });
120
+
121
+ const data = await scraper.scrapePost(
122
+ 'https://www.instagram.com/p/ABC123/',
123
+ {
124
+ saveToFile: true,
125
+ outputPath: './instagram_downloads',
126
+ timeout: 90
127
+ }
128
+ );
129
+
130
+ console.log(`✅ Downloaded ${data.images.length} images from @${data.profile_name}`);
131
+ console.log('Images:', data.images);
132
+
133
+ } catch (error) {
134
+ console.error('❌ Error:', error.message);
135
+ }
136
+ }
137
+
138
+ downloadInstagramPost();
139
+ ```
140
+
141
+ ## Requirements
142
+
143
+ - Node.js 16 or newer
144
+ - Internet connection
145
+ - For private posts: valid Instagram account
146
+
147
+ ## License
148
+
149
+ MIT - use anywhere
150
+
151
+ ## Support
152
+
153
+ Having issues? Create an [issue on GitHub](https://github.com/nykadamec/instasave-sdk/issues)
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Fast authentication module for Instagram login
3
+ */
4
+ import { Page } from 'puppeteer';
5
+ export interface LoginCredentials {
6
+ username: string;
7
+ password: string;
8
+ }
9
+ export declare class FastAuthManager {
10
+ private authenticated;
11
+ private username;
12
+ private displayName;
13
+ private sessionPath;
14
+ constructor();
15
+ private sleep;
16
+ private loadSession;
17
+ private saveSession;
18
+ private clearSession;
19
+ saveSessionData(cookies?: any[]): Promise<void>;
20
+ refreshSession(page: Page): Promise<boolean>;
21
+ isAuthenticated(): boolean;
22
+ getUsername(): string | null;
23
+ getDisplayName(): string | null;
24
+ logout(): Promise<void>;
25
+ refreshUserInfo(page: Page): Promise<{
26
+ username: string | null;
27
+ displayName: string | null;
28
+ }>;
29
+ applyCookies(page: Page): Promise<void>;
30
+ login(page: Page, credentials: LoginCredentials): Promise<boolean>;
31
+ }
32
+ //# sourceMappingURL=auth-fast.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-fast.d.ts","sourceRoot":"","sources":["../src/auth-fast.ts"],"names":[],"mappings":"AACA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,WAAW,CAAsC;;IAMzD,OAAO,CAAC,KAAK;YAIC,WAAW;YAeX,WAAW;YA0BX,YAAY;IAYpB,eAAe,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/C,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC;IAwClD,eAAe,IAAI,OAAO;IAI1B,WAAW,IAAI,MAAM,GAAG,IAAI;IAI5B,cAAc,IAAI,MAAM,GAAG,IAAI;IAIzB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAOvB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAiG7F,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IA6BvC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;CA8TzE"}