priyansh-ig-downloader 2.0.3 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/dist/bundle.js +40 -4
  2. package/package.json +3 -3
package/dist/bundle.js CHANGED
@@ -1,48 +1,84 @@
1
1
  (function (global, factory) {
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3
3
  typeof define === 'function' && define.amd ? define(factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global["priyansh-ig-downloader"] = factory());
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global["insta-package"] = factory());
5
5
  })(this, (function () { 'use strict';
6
6
 
7
7
  const CryptoJS = require('crypto-js');
8
- const fetch = require('node-fetch'); // Add this line to import fetch in Node.js
8
+ const { fetch } = require('undici'); // Import fetch from undici
9
+
9
10
 
10
11
  function encrypt (input) {
12
+
11
13
  const key = CryptoJS.enc.Utf8.parse('qwertyuioplkjhgf');
14
+
12
15
  const iv = CryptoJS.lib.WordArray.random(16); // IV length is 16 bytes
13
16
 
17
+
18
+
14
19
  const encrypted = CryptoJS.AES.encrypt(input, key, {
20
+
15
21
  iv: iv,
22
+
16
23
  mode: CryptoJS.mode.ECB,
24
+
17
25
  padding: CryptoJS.pad.Pkcs7,
26
+
18
27
  });
19
28
 
29
+
30
+
20
31
  // Convert the encrypted bytes to a hex string
32
+
21
33
  const encryptedHex = encrypted.ciphertext.toString(CryptoJS.enc.Hex);
34
+
22
35
  return encryptedHex;
36
+
23
37
  }
24
38
 
25
39
  async function main (url) {
26
40
 
41
+
42
+
27
43
  return new Promise(async (resolve, reject) => {
44
+
28
45
  try {
46
+
29
47
  const base_url = "https://backend.instavideosave.com/allinone";
48
+
30
49
  const headers = {
50
+
31
51
  'url': encrypt(url)
52
+
32
53
  };
33
- const response = await fetch(base_url, { // Using fetch from node-fetch
54
+
55
+ const response = await fetch(base_url, {
56
+
34
57
  method: "GET",
58
+
35
59
  headers,
60
+
36
61
  });
62
+
37
63
  const data = await response.json();
38
64
 
65
+
66
+
39
67
  if (!data) reject({ result: null });
68
+
40
69
  delete data.fetch;
70
+
41
71
  resolve(data);
72
+
42
73
  } catch (err) {
74
+
43
75
  reject(err);
76
+
44
77
  }
45
- });
78
+
79
+ })
80
+
81
+
46
82
 
47
83
  }
48
84
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  {
3
3
  "name": "priyansh-ig-downloader",
4
- "version": "2.0.3",
4
+ "version": "2.0.4",
5
5
  "main": "dist/bundle.js",
6
6
  "scripts": {
7
7
  "build": "rollup --config",
@@ -46,7 +46,7 @@
46
46
  "homepage": "https://github.com/priyanshu192/priyansh-ig-downloader#readme",
47
47
  "dependencies": {
48
48
  "crypto-js": "^4.2.0",
49
- "node-fetch": "^2.6.5"
49
+ "undici": "^5.28.4"
50
50
  },
51
51
  "devDependencies": {
52
52
  "rollup": "^4.18.0"
@@ -56,7 +56,7 @@
56
56
  "LICENSE"
57
57
  ],
58
58
  "engines": {
59
- "node": ">=14.0.0"
59
+ "node": ">=16.0.0"
60
60
  },
61
61
  "private": false,
62
62
  "directories": {