Update plugins/alldownloader.js
Browse files- plugins/alldownloader.js +45 -1
plugins/alldownloader.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import express from 'express';
|
2 |
import { TiktokDownloader, XnxxDownloader } from '../lib/scrapper.js';
|
3 |
import { facebookdl } from '../lib/facebook.js';
|
|
|
4 |
import { authenticateApiKey, apiLimiter } from '../middleware/midware.js';
|
5 |
const AllDlRoutes = express.Router();
|
6 |
|
@@ -58,7 +59,7 @@ AllDlRoutes.get('/api/v1/dl/tiktok', authenticateApiKey, apiLimiter, async (req,
|
|
58 |
* - in: query
|
59 |
* name: url
|
60 |
* required: true
|
61 |
-
* description:
|
62 |
* schema:
|
63 |
* type: string
|
64 |
* - in: header
|
@@ -91,6 +92,49 @@ AllDlRoutes.get('/api/v1/dl/fb', authenticateApiKey, apiLimiter, async (req, res
|
|
91 |
}
|
92 |
});
|
93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
/**
|
95 |
* @swagger
|
96 |
* /api/v1/dl/xnxx:
|
|
|
1 |
import express from 'express';
|
2 |
import { TiktokDownloader, XnxxDownloader } from '../lib/scrapper.js';
|
3 |
import { facebookdl } from '../lib/facebook.js';
|
4 |
+
import { savefrom } from '../lib/savefrom.js';
|
5 |
import { authenticateApiKey, apiLimiter } from '../middleware/midware.js';
|
6 |
const AllDlRoutes = express.Router();
|
7 |
|
|
|
59 |
* - in: query
|
60 |
* name: url
|
61 |
* required: true
|
62 |
+
* description: null
|
63 |
* schema:
|
64 |
* type: string
|
65 |
* - in: header
|
|
|
92 |
}
|
93 |
});
|
94 |
|
95 |
+
/**
|
96 |
+
* @swagger
|
97 |
+
* /api/v1/dl/savefrom:
|
98 |
+
* get:
|
99 |
+
* summary: Savefrom Downloader
|
100 |
+
* tags: [ALL-Downloader]
|
101 |
+
* parameters:
|
102 |
+
* - in: query
|
103 |
+
* name: url
|
104 |
+
* required: true
|
105 |
+
* description: null
|
106 |
+
* schema:
|
107 |
+
* type: string
|
108 |
+
* - in: header
|
109 |
+
* name: x-api-key
|
110 |
+
* required: true
|
111 |
+
* description: API key for authentication
|
112 |
+
* schema:
|
113 |
+
* type: string
|
114 |
+
* responses:
|
115 |
+
* 200:
|
116 |
+
* description: Success
|
117 |
+
* 400:
|
118 |
+
* description: Bad Request (e.g., missing or invalid url)
|
119 |
+
* 401:
|
120 |
+
* description: Unauthorized (e.g., missing or invalid API key)
|
121 |
+
* 500:
|
122 |
+
* description: Internal Server Error
|
123 |
+
*/
|
124 |
+
AllDlRoutes.get('/api/v1/dl/savefrom', authenticateApiKey, apiLimiter, async (req, res) => {
|
125 |
+
try {
|
126 |
+
const url = req.query.url;
|
127 |
+
|
128 |
+
if (!url) {
|
129 |
+
return res.status(400).json({ error: "url parameter is required." });
|
130 |
+
}
|
131 |
+
const results = await savefrom(url);
|
132 |
+
res.json({ results });
|
133 |
+
} catch (error) {
|
134 |
+
res.status(500).json({ error: error.message });
|
135 |
+
}
|
136 |
+
});
|
137 |
+
|
138 |
/**
|
139 |
* @swagger
|
140 |
* /api/v1/dl/xnxx:
|