Closure-RI commited on
Commit
ae95ffe
·
verified ·
1 Parent(s): 9f1ed9b

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +9 -12
index.js CHANGED
@@ -988,7 +988,6 @@ app.get('/r34cookie', async (req, res) => {
988
 
989
 
990
 
991
-
992
  // Fungsi untuk mendapatkan data dari API Pixiv berdasarkan ID ilustrasi
993
  async function pixivGetData(illustId) {
994
  const headers = {
@@ -1079,17 +1078,15 @@ app.get("/process-pixiv/:illustId", async (req, res) => {
1079
  const pixivData = await pixivGetData(illustId);
1080
  const frameDir = await downloadAndExtractZipFromPixivData(pixivData);
1081
  const videoPath = await createVideoFromExtractedImages(pixivData, frameDir);
1082
-
1083
- // Kirim URL statis file video
1084
- res.sendFile(videoPath, (err) => {
1085
- if (err) {
1086
- console.error("Error sending file:", err);
1087
- res.status(500).send("Error sending video file.");
1088
- } else {
1089
- console.log("File sent successfully.");
1090
- scheduleFolderDeletion(frameDir); // Hapus folder setelah 2 menit
1091
- }
1092
- });
1093
  } catch (error) {
1094
  console.error("Error processing Pixiv illustration:", error);
1095
  res.status(500).send("Error processing illustration.");
 
988
 
989
 
990
 
 
991
  // Fungsi untuk mendapatkan data dari API Pixiv berdasarkan ID ilustrasi
992
  async function pixivGetData(illustId) {
993
  const headers = {
 
1078
  const pixivData = await pixivGetData(illustId);
1079
  const frameDir = await downloadAndExtractZipFromPixivData(pixivData);
1080
  const videoPath = await createVideoFromExtractedImages(pixivData, frameDir);
1081
+
1082
+ // Buat URL untuk mengakses file mp4
1083
+ const videoUrl = `https://arashicode-komik.hf.space/static/${path.relative(tmpDir, videoPath)}`;
1084
+
1085
+ // Kirim URL file mp4 dalam format JSON
1086
+ res.json({ url: videoUrl });
1087
+
1088
+ // Jadwalkan penghapusan file setelah 2 menit
1089
+ scheduleFolderDeletion(frameDir);
 
 
1090
  } catch (error) {
1091
  console.error("Error processing Pixiv illustration:", error);
1092
  res.status(500).send("Error processing illustration.");