priyansh-ig-downloader 2.0.2 → 2.0.4

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