@jerrycoder/instagram-api 2.5.5 โ 2.5.6
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/README.md +12 -2
- package/index.js +27 -7
- package/index.mjs +27 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -103,12 +103,22 @@ Depends on external API availability
|
|
|
103
103
|
โข ๐งฉ Works with CommonJS & ESM
|
|
104
104
|
|
|
105
105
|
|
|
106
|
+
## ๐ Security
|
|
107
|
+
|
|
108
|
+
This package makes HTTP requests to:
|
|
109
|
+
https://jerrycoder.oggyapi.workers.dev
|
|
110
|
+
|
|
111
|
+
- No personal data is collected
|
|
112
|
+
- No tracking is performed
|
|
113
|
+
- Open for inspection
|
|
114
|
+
|
|
115
|
+
|
|
106
116
|
## ๐งช Status
|
|
107
117
|
|
|
108
118
|
ยฐ โ
Fully Tested on Node.js & Vercel
|
|
109
119
|
|
|
110
|
-
ยฐ ๐ Version: 2.5.
|
|
120
|
+
ยฐ ๐ Version: 2.5.6 (Latest)
|
|
111
121
|
|
|
112
122
|
|
|
113
123
|
## ๐ License
|
|
114
|
-
MIT License ยฉ JerryCoder
|
|
124
|
+
MIT License ยฉ JerryCoder
|
package/index.js
CHANGED
|
@@ -1,16 +1,36 @@
|
|
|
1
1
|
const axios = require("axios");
|
|
2
2
|
|
|
3
|
-
|
|
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
|
|
7
|
-
const
|
|
8
|
+
const apiBase = options.api || DEFAULT_API;
|
|
9
|
+
const timeout = options.timeout || 10000;
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
7
|
-
const
|
|
8
|
+
const apiBase = options.api || DEFAULT_API;
|
|
9
|
+
const timeout = options.timeout || 10000;
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
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