Update plugins/alldownloader.js
Browse files- plugins/alldownloader.js +24 -3
plugins/alldownloader.js
CHANGED
@@ -33,7 +33,15 @@ const AllDlRoutes = express.Router();
|
|
33 |
|
34 |
const dbClient = new Database("AkenoXJs");
|
35 |
const db = dbClient.collection("api_keys");
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
async function downloadMedia(media) {
|
38 |
const downloadResults = {};
|
39 |
try {
|
@@ -301,6 +309,7 @@ AllDlRoutes.get('/api/v1/dl/instagram-v2', authenticateApiKey, apiLimiter, async
|
|
301 |
if (!q) {
|
302 |
return res.status(400).json({ error: "URL parameter is required." });
|
303 |
}
|
|
|
304 |
await TelegramUseLog(
|
305 |
keyDoc.owner,
|
306 |
keyDoc.key,
|
@@ -375,6 +384,7 @@ AllDlRoutes.get('/api/v1/dl/pint', authenticateApiKey, apiLimiter, async (req, r
|
|
375 |
if (!q) {
|
376 |
return res.status(400).json({ error: "URL parameter is required." });
|
377 |
}
|
|
|
378 |
await TelegramUseLog(
|
379 |
keyDoc.owner,
|
380 |
keyDoc.key,
|
@@ -450,6 +460,7 @@ AllDlRoutes.get('/api/v1/dl/sfilemobi-search', authenticateApiKey, apiLimiter, a
|
|
450 |
if (!q) {
|
451 |
return res.status(400).json({ error: "URL parameter is required." });
|
452 |
}
|
|
|
453 |
await TelegramUseLog(
|
454 |
keyDoc.owner,
|
455 |
keyDoc.key,
|
@@ -524,6 +535,7 @@ AllDlRoutes.get('/api/v1/dl/terabox-v2', authenticateApiKey, apiLimiter, async (
|
|
524 |
if (!url) {
|
525 |
return res.status(400).json({ error: "URL parameter is required." });
|
526 |
}
|
|
|
527 |
await TelegramUseLog(
|
528 |
keyDoc.owner,
|
529 |
keyDoc.key,
|
@@ -598,6 +610,7 @@ AllDlRoutes.get('/api/v1/dl/terabox', authenticateApiKey, apiLimiter, async (req
|
|
598 |
if (!url) {
|
599 |
return res.status(400).json({ error: "URL parameter is required." });
|
600 |
}
|
|
|
601 |
await TelegramUseLog(
|
602 |
keyDoc.owner,
|
603 |
keyDoc.key,
|
@@ -673,6 +686,7 @@ AllDlRoutes.get('/api/v1/dl/capcut', authenticateApiKey, apiLimiter, async (req,
|
|
673 |
if (!url) {
|
674 |
return res.status(400).json({ error: "URL parameter is required." });
|
675 |
}
|
|
|
676 |
await TelegramUseLog(
|
677 |
keyDoc.owner,
|
678 |
keyDoc.key,
|
@@ -748,6 +762,7 @@ AllDlRoutes.get('/api/v1/dl/instagram', authenticateApiKey, apiLimiter, async (r
|
|
748 |
if (!url) {
|
749 |
return res.status(400).json({ error: "URL parameter is required." });
|
750 |
}
|
|
|
751 |
await TelegramUseLog(
|
752 |
keyDoc.owner,
|
753 |
keyDoc.key,
|
@@ -822,6 +837,7 @@ AllDlRoutes.get('/api/v1/dl/twitter', authenticateApiKey, apiLimiter, async (req
|
|
822 |
if (!url) {
|
823 |
return res.status(400).json({ error: "URL parameter is required." });
|
824 |
}
|
|
|
825 |
await TelegramUseLog(
|
826 |
keyDoc.owner,
|
827 |
keyDoc.key,
|
@@ -896,6 +912,7 @@ AllDlRoutes.get('/api/v1/dl/sfilemobi', authenticateApiKey, apiLimiter, async (r
|
|
896 |
if (!url) {
|
897 |
return res.status(400).json({ error: "URL parameter is required." });
|
898 |
}
|
|
|
899 |
await TelegramUseLog(
|
900 |
keyDoc.owner,
|
901 |
keyDoc.key,
|
@@ -970,6 +987,7 @@ AllDlRoutes.get('/api/v1/dl/tiktok', authenticateApiKey, apiLimiter, async (req,
|
|
970 |
if (!url) {
|
971 |
return res.status(400).json({ error: "URL parameter is required." });
|
972 |
}
|
|
|
973 |
await TelegramUseLog(
|
974 |
keyDoc.owner,
|
975 |
keyDoc.key,
|
@@ -1045,6 +1063,7 @@ AllDlRoutes.get('/api/v1/dl/tiktok-v2', authenticateApiKey, apiLimiter, async (r
|
|
1045 |
return res.status(400).json({ error: "URL parameter is required." });
|
1046 |
}
|
1047 |
|
|
|
1048 |
await TelegramUseLog(
|
1049 |
keyDoc.owner,
|
1050 |
keyDoc.key,
|
@@ -1060,7 +1079,6 @@ AllDlRoutes.get('/api/v1/dl/tiktok-v2', authenticateApiKey, apiLimiter, async (r
|
|
1060 |
}
|
1061 |
});
|
1062 |
|
1063 |
-
|
1064 |
/**
|
1065 |
* @swagger
|
1066 |
* /api/v1/dl/fb:
|
@@ -1132,7 +1150,7 @@ AllDlRoutes.get('/api/v1/dl/fb', authenticateApiKey, apiLimiter, async (req, res
|
|
1132 |
for (const audio of results.audio) {
|
1133 |
audio.url = await audio.download();
|
1134 |
}
|
1135 |
-
|
1136 |
await TelegramUseLog(
|
1137 |
keyDoc.owner,
|
1138 |
keyDoc.key,
|
@@ -1207,6 +1225,7 @@ AllDlRoutes.get('/api/v1/dl/snapsave', authenticateApiKey, apiLimiter, async (re
|
|
1207 |
if (!url) {
|
1208 |
return res.status(400).json({ error: "url parameter is required." });
|
1209 |
}
|
|
|
1210 |
await TelegramUseLog(
|
1211 |
keyDoc.owner,
|
1212 |
keyDoc.key,
|
@@ -1281,6 +1300,7 @@ AllDlRoutes.get('/api/v1/dl/savefrom', authenticateApiKey, apiLimiter, async (re
|
|
1281 |
if (!url) {
|
1282 |
return res.status(400).json({ error: "url parameter is required." });
|
1283 |
}
|
|
|
1284 |
await TelegramUseLog(
|
1285 |
keyDoc.owner,
|
1286 |
keyDoc.key,
|
@@ -1355,6 +1375,7 @@ AllDlRoutes.get('/api/v1/dl/xnxx', authenticateApiKey, apiLimiter, async (req, r
|
|
1355 |
if (!q) {
|
1356 |
return res.status(400).json({ error: "q parameter is required." });
|
1357 |
}
|
|
|
1358 |
await TelegramUseLog(
|
1359 |
keyDoc.owner,
|
1360 |
keyDoc.key,
|
|
|
33 |
|
34 |
const dbClient = new Database("AkenoXJs");
|
35 |
const db = dbClient.collection("api_keys");
|
36 |
+
|
37 |
+
async function updateIP(apiKey, newIP) {
|
38 |
+
await db.updateOne(
|
39 |
+
{ key: apiKey },
|
40 |
+
{ $addToSet: { ip_addresses: newIP } }
|
41 |
+
);
|
42 |
+
}
|
43 |
+
|
44 |
+
|
45 |
async function downloadMedia(media) {
|
46 |
const downloadResults = {};
|
47 |
try {
|
|
|
309 |
if (!q) {
|
310 |
return res.status(400).json({ error: "URL parameter is required." });
|
311 |
}
|
312 |
+
await updateIP(apiKey, realIP);
|
313 |
await TelegramUseLog(
|
314 |
keyDoc.owner,
|
315 |
keyDoc.key,
|
|
|
384 |
if (!q) {
|
385 |
return res.status(400).json({ error: "URL parameter is required." });
|
386 |
}
|
387 |
+
await updateIP(apiKey, realIP);
|
388 |
await TelegramUseLog(
|
389 |
keyDoc.owner,
|
390 |
keyDoc.key,
|
|
|
460 |
if (!q) {
|
461 |
return res.status(400).json({ error: "URL parameter is required." });
|
462 |
}
|
463 |
+
await updateIP(apiKey, realIP);
|
464 |
await TelegramUseLog(
|
465 |
keyDoc.owner,
|
466 |
keyDoc.key,
|
|
|
535 |
if (!url) {
|
536 |
return res.status(400).json({ error: "URL parameter is required." });
|
537 |
}
|
538 |
+
await updateIP(apiKey, realIP);
|
539 |
await TelegramUseLog(
|
540 |
keyDoc.owner,
|
541 |
keyDoc.key,
|
|
|
610 |
if (!url) {
|
611 |
return res.status(400).json({ error: "URL parameter is required." });
|
612 |
}
|
613 |
+
await updateIP(apiKey, realIP);
|
614 |
await TelegramUseLog(
|
615 |
keyDoc.owner,
|
616 |
keyDoc.key,
|
|
|
686 |
if (!url) {
|
687 |
return res.status(400).json({ error: "URL parameter is required." });
|
688 |
}
|
689 |
+
await updateIP(apiKey, realIP);
|
690 |
await TelegramUseLog(
|
691 |
keyDoc.owner,
|
692 |
keyDoc.key,
|
|
|
762 |
if (!url) {
|
763 |
return res.status(400).json({ error: "URL parameter is required." });
|
764 |
}
|
765 |
+
await updateIP(apiKey, realIP);
|
766 |
await TelegramUseLog(
|
767 |
keyDoc.owner,
|
768 |
keyDoc.key,
|
|
|
837 |
if (!url) {
|
838 |
return res.status(400).json({ error: "URL parameter is required." });
|
839 |
}
|
840 |
+
await updateIP(apiKey, realIP);
|
841 |
await TelegramUseLog(
|
842 |
keyDoc.owner,
|
843 |
keyDoc.key,
|
|
|
912 |
if (!url) {
|
913 |
return res.status(400).json({ error: "URL parameter is required." });
|
914 |
}
|
915 |
+
await updateIP(apiKey, realIP);
|
916 |
await TelegramUseLog(
|
917 |
keyDoc.owner,
|
918 |
keyDoc.key,
|
|
|
987 |
if (!url) {
|
988 |
return res.status(400).json({ error: "URL parameter is required." });
|
989 |
}
|
990 |
+
await updateIP(apiKey, realIP);
|
991 |
await TelegramUseLog(
|
992 |
keyDoc.owner,
|
993 |
keyDoc.key,
|
|
|
1063 |
return res.status(400).json({ error: "URL parameter is required." });
|
1064 |
}
|
1065 |
|
1066 |
+
await updateIP(apiKey, realIP);
|
1067 |
await TelegramUseLog(
|
1068 |
keyDoc.owner,
|
1069 |
keyDoc.key,
|
|
|
1079 |
}
|
1080 |
});
|
1081 |
|
|
|
1082 |
/**
|
1083 |
* @swagger
|
1084 |
* /api/v1/dl/fb:
|
|
|
1150 |
for (const audio of results.audio) {
|
1151 |
audio.url = await audio.download();
|
1152 |
}
|
1153 |
+
await updateIP(apiKey, realIP);
|
1154 |
await TelegramUseLog(
|
1155 |
keyDoc.owner,
|
1156 |
keyDoc.key,
|
|
|
1225 |
if (!url) {
|
1226 |
return res.status(400).json({ error: "url parameter is required." });
|
1227 |
}
|
1228 |
+
await updateIP(apiKey, realIP);
|
1229 |
await TelegramUseLog(
|
1230 |
keyDoc.owner,
|
1231 |
keyDoc.key,
|
|
|
1300 |
if (!url) {
|
1301 |
return res.status(400).json({ error: "url parameter is required." });
|
1302 |
}
|
1303 |
+
await updateIP(apiKey, realIP);
|
1304 |
await TelegramUseLog(
|
1305 |
keyDoc.owner,
|
1306 |
keyDoc.key,
|
|
|
1375 |
if (!q) {
|
1376 |
return res.status(400).json({ error: "q parameter is required." });
|
1377 |
}
|
1378 |
+
await updateIP(apiKey, realIP);
|
1379 |
await TelegramUseLog(
|
1380 |
keyDoc.owner,
|
1381 |
keyDoc.key,
|