Update plugins/alldownloader.js
Browse files- plugins/alldownloader.js +12 -5
plugins/alldownloader.js
CHANGED
@@ -236,14 +236,22 @@ AllDlRoutes.get('/api/v1/dl/youtube', authenticateApiKey, apiLimiter, async (req
|
|
236 |
console.log(resolutions);
|
237 |
|
238 |
if (resolutions.length > 0) {
|
239 |
-
const
|
240 |
-
|
|
|
|
|
|
|
|
|
241 |
}
|
242 |
|
243 |
const audioResolutions = Object.keys(results.audio);
|
244 |
if (audioResolutions.length > 0) {
|
245 |
-
const
|
246 |
-
|
|
|
|
|
|
|
|
|
247 |
}
|
248 |
|
249 |
res.json({ results });
|
@@ -252,7 +260,6 @@ AllDlRoutes.get('/api/v1/dl/youtube', authenticateApiKey, apiLimiter, async (req
|
|
252 |
}
|
253 |
});
|
254 |
|
255 |
-
|
256 |
/**
|
257 |
* @swagger
|
258 |
* /api/v1/dl/savefrom:
|
|
|
236 |
console.log(resolutions);
|
237 |
|
238 |
if (resolutions.length > 0) {
|
239 |
+
const videoDownload = await results.video[resolutions[0]].download(results.id, results.video[resolutions[0]].k); // Pass necessary parameters
|
240 |
+
if (videoDownload) {
|
241 |
+
results.video[resolutions[0]].url = videoDownload;
|
242 |
+
} else {
|
243 |
+
console.error("Download link is missing for video:", resolutions[0]);
|
244 |
+
}
|
245 |
}
|
246 |
|
247 |
const audioResolutions = Object.keys(results.audio);
|
248 |
if (audioResolutions.length > 0) {
|
249 |
+
const audioDownload = await results.audio[audioResolutions[0]].download(results.id, results.audio[audioResolutions[0]].k); // Pass necessary parameters
|
250 |
+
if (audioDownload) {
|
251 |
+
results.audio[audioResolutions[0]].url = audioDownload;
|
252 |
+
} else {
|
253 |
+
console.error("Download link is missing for audio:", audioResolutions[0]);
|
254 |
+
}
|
255 |
}
|
256 |
|
257 |
res.json({ results });
|
|
|
260 |
}
|
261 |
});
|
262 |
|
|
|
263 |
/**
|
264 |
* @swagger
|
265 |
* /api/v1/dl/savefrom:
|