@jerrycoder/instagram-api 2.5.5 โ†’ 2.5.7

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 (4) hide show
  1. package/README.md +10 -13
  2. package/index.js +27 -7
  3. package/index.mjs +27 -7
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -33,17 +33,6 @@ const data = await instagram("https://www.instagram.com/reel/xxxxx/");
33
33
  console.log(data);
34
34
  ```
35
35
 
36
- ๐Ÿ“ก Response Example
37
- ```bash
38
- {
39
- "status": "success",
40
- "data": {
41
- "type": "https://...",
42
- "url": "https://..."
43
- }
44
- }
45
- ```
46
-
47
36
  ## โ˜๏ธ Deploy on Vercel (API Endpoint)
48
37
 
49
38
  Create file:
@@ -89,8 +78,6 @@ URL must be a valid Instagram post/reel/story
89
78
 
90
79
  Private content is not supported
91
80
 
92
- Depends on external API availability
93
-
94
81
 
95
82
  ## ๐Ÿ› ๏ธ Features
96
83
 
@@ -103,6 +90,16 @@ Depends on external API availability
103
90
  โ€ข ๐Ÿงฉ Works with CommonJS & ESM
104
91
 
105
92
 
93
+ ## ๐Ÿ” Security
94
+
95
+ This package makes HTTP requests to:
96
+ https://jerrycoder.oggyapi.workers.dev
97
+
98
+ - No personal data is collected
99
+ - No tracking is performed
100
+ - Open for inspection
101
+
102
+
106
103
  ## ๐Ÿงช Status
107
104
 
108
105
  ยฐ โœ… Fully Tested on Node.js & Vercel
package/index.js CHANGED
@@ -1,16 +1,36 @@
1
1
  const axios = require("axios");
2
2
 
3
- async function instagram(url) {
3
+ const DEFAULT_API = "https://jerrycoder.oggyapi.workers.dev";
4
+
5
+ async function instagram(url, options = {}) {
4
6
  if (!url) throw new Error("URL is required");
5
7
 
6
- const apiUrl = `https://jerrycoder.oggyapi.workers.dev/insta?url=${encodeURIComponent(url)}`;
7
- const { data } = await axios.get(apiUrl);
8
+ const apiBase = options.api || DEFAULT_API;
9
+ const timeout = options.timeout || 10000;
8
10
 
9
- if (data.status !== "success") {
10
- throw new Error("Failed to fetch data");
11
- }
11
+ const apiUrl = `${apiBase}/insta?url=${encodeURIComponent(url)}`;
12
+
13
+ try {
14
+ const response = await axios.get(apiUrl, {
15
+ timeout,
16
+ headers: {
17
+ "User-Agent": "jerrycoder-instagram-api/2.5.5",
18
+ "Accept": "application/json"
19
+ },
20
+ validateStatus: (status) => status < 500
21
+ });
22
+
23
+ const data = response.data;
12
24
 
13
- return data.data;
25
+ if (!data || data.status !== "success") {
26
+ throw new Error(data?.message || "Failed to fetch data");
27
+ }
28
+
29
+ return data.data;
30
+
31
+ } catch (err) {
32
+ throw new Error(`API request failed: ${err.message}`);
33
+ }
14
34
  }
15
35
 
16
36
  module.exports = {
package/index.mjs CHANGED
@@ -1,16 +1,36 @@
1
1
  import axios from "axios";
2
2
 
3
- export async function instagram(url) {
3
+ const DEFAULT_API = "https://jerrycoder.oggyapi.workers.dev";
4
+
5
+ export async function instagram(url, options = {}) {
4
6
  if (!url) throw new Error("URL is required");
5
7
 
6
- const apiUrl = `https://jerrycoder.oggyapi.workers.dev/insta?url=${encodeURIComponent(url)}`;
7
- const { data } = await axios.get(apiUrl);
8
+ const apiBase = options.api || DEFAULT_API;
9
+ const timeout = options.timeout || 10000;
8
10
 
9
- if (data.status !== "success") {
10
- throw new Error("Failed to fetch data");
11
- }
11
+ const apiUrl = `${apiBase}/insta?url=${encodeURIComponent(url)}`;
12
+
13
+ try {
14
+ const response = await axios.get(apiUrl, {
15
+ timeout,
16
+ headers: {
17
+ "User-Agent": "jerrycoder-instagram-api/2.5.5",
18
+ "Accept": "application/json"
19
+ },
20
+ validateStatus: (status) => status < 500 // prevent throwing on 4xx
21
+ });
22
+
23
+ const data = response.data;
12
24
 
13
- return data.data;
25
+ if (!data || data.status !== "success") {
26
+ throw new Error(data?.message || "Failed to fetch data");
27
+ }
28
+
29
+ return data.data;
30
+
31
+ } catch (err) {
32
+ throw new Error(`API request failed: ${err.message}`);
33
+ }
14
34
  }
15
35
 
16
36
  export default {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jerrycoder/instagram-api",
3
- "version": "2.5.5",
3
+ "version": "2.5.7",
4
4
  "description": "Unofficial Instagram Downloader API โ€” fetch Reels, Posts, Stories using JerryCoder API.",
5
5
  "main": "index.js",
6
6
  "author": "JerryCoder",