Spaces:
Paused
Paused
Update index.js
Browse files
index.js
CHANGED
|
@@ -323,6 +323,8 @@ async function Shinigami_download(url) {
|
|
| 323 |
});
|
| 324 |
return data;
|
| 325 |
});
|
|
|
|
|
|
|
| 326 |
|
| 327 |
const imagePaths = await downloadImages(imgList, tempDir, instanceID);
|
| 328 |
const pdfPath = await createPDF(instanceID, tempDir);
|
|
@@ -389,15 +391,13 @@ async function komiku_download(url) {
|
|
| 389 |
}
|
| 390 |
|
| 391 |
async function downloadImage(image, tempDir, instanceID) {
|
| 392 |
-
const response = await axios.get(image.path, { responseType: 'arraybuffer'
|
| 393 |
-
|
|
|
|
|
|
|
|
|
|
| 394 |
await writeFileAsync(imagePath, response.data);
|
| 395 |
|
| 396 |
-
const imageHeight = await getImageHeight(imagePath);
|
| 397 |
-
const newHeight = Math.floor(imageHeight * 0.7);
|
| 398 |
-
const command = `convert ${imagePath} -resize 720x${newHeight}! -quality 75 -background white -gravity center -extent 720x${newHeight} ${imagePath}`;
|
| 399 |
-
await execPromise(command);
|
| 400 |
-
|
| 401 |
return imagePath;
|
| 402 |
}
|
| 403 |
|
|
|
|
| 323 |
});
|
| 324 |
return data;
|
| 325 |
});
|
| 326 |
+
|
| 327 |
+
console.log(imgList)
|
| 328 |
|
| 329 |
const imagePaths = await downloadImages(imgList, tempDir, instanceID);
|
| 330 |
const pdfPath = await createPDF(instanceID, tempDir);
|
|
|
|
| 391 |
}
|
| 392 |
|
| 393 |
async function downloadImage(image, tempDir, instanceID) {
|
| 394 |
+
const response = await axios.get(image.path, { responseType: 'arraybuffer', headers: {
|
| 395 |
+
'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;]',
|
| 396 |
+
'Referer': 'https://komiku.id/'
|
| 397 |
+
}});
|
| 398 |
+
const imagePath = `${tempDir}/image_${instanceID}_${Date.now()}_${Math.floor(Math.random() * 1000)}.jpg`;
|
| 399 |
await writeFileAsync(imagePath, response.data);
|
| 400 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 401 |
return imagePath;
|
| 402 |
}
|
| 403 |
|