Nexchan commited on
Commit
8fdfea7
1 Parent(s): d43825e

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +9 -2
index.js CHANGED
@@ -20,6 +20,11 @@ const fss = fs.promises;
20
 
21
  app.use('/static', express.static(os.tmpdir()));
22
 
 
 
 
 
 
23
  function generateRandomID(length = 8) {
24
  const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
25
  let result = '';
@@ -40,7 +45,8 @@ async function komiku_download(url) {
40
  const response = await axios.get(url, {
41
  headers: {
42
  'User-Agent': 'Mozilla/5.0 (Linux; Android 6.0.1; SM-N916S Build/MMB29K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/106.0.5249.126 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/389.0.0.42.111;]',
43
- 'Referer': 'https://komiku.id/'
 
44
  }
45
  });
46
  const html = response.data;
@@ -69,7 +75,8 @@ async function downloadImage(image, tempDir, instanceID) {
69
  responseType: 'arraybuffer',
70
  headers: {
71
  'User-Agent': 'Mozilla/5.0 (Linux; Android 6.0.1; SM-N916S Build/MMB29K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/106.0.5249.126 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/389.0.0.42.111;]',
72
- 'Referer': 'https://komiku.id/'
 
73
  }
74
  });
75
  const imagePath = path.join(tempDir, `image_${instanceID}_${Date.now()}_${Math.floor(Math.random() * 1000)}.jpg`);
 
20
 
21
  app.use('/static', express.static(os.tmpdir()));
22
 
23
+ const generateRandomIP = () => {
24
+ const octet = () => Math.floor(Math.random() * 256);
25
+ return `${octet()}.${octet()}.${octet()}.${octet()}`;
26
+ };
27
+
28
  function generateRandomID(length = 8) {
29
  const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
30
  let result = '';
 
45
  const response = await axios.get(url, {
46
  headers: {
47
  'User-Agent': 'Mozilla/5.0 (Linux; Android 6.0.1; SM-N916S Build/MMB29K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/106.0.5249.126 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/389.0.0.42.111;]',
48
+ 'Referer': 'https://komiku.id/devious-son-of-heaven-chapter-04/',
49
+ 'X-Forwarded-For': generateRandomIP()
50
  }
51
  });
52
  const html = response.data;
 
75
  responseType: 'arraybuffer',
76
  headers: {
77
  'User-Agent': 'Mozilla/5.0 (Linux; Android 6.0.1; SM-N916S Build/MMB29K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/106.0.5249.126 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/389.0.0.42.111;]',
78
+ 'Referer': 'https://komiku.id/devious-son-of-heaven-chapter-04/',
79
+ 'X-Forwarded-For': generateRandomIP()
80
  }
81
  });
82
  const imagePath = path.join(tempDir, `image_${instanceID}_${Date.now()}_${Math.floor(Math.random() * 1000)}.jpg`);