randydev commited on
Commit
fc3dc85
·
verified ·
1 Parent(s): 933e1a7

Create alldownloader.js

Browse files
Files changed (1) hide show
  1. plugins/alldownloader.js +33 -0
plugins/alldownloader.js ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import express from 'express';
2
+ import { TiktokDownloader } from '../lib/scrapper.js';
3
+ import { authenticateApiKey, apiLimiter } from '../middleware/midware.js';
4
+ const AllDlRoutes = express.Router();
5
+
6
+ /**
7
+ * @swagger
8
+ * /api/v1/dl/tiktok:
9
+ * get:
10
+ * summary: Tiktok Downloader
11
+ * tags: [ALL-Downloader]
12
+ * parameters:
13
+ * - in: query
14
+ * name: url
15
+ * required: true
16
+ * description: The query to be processed by the GPT OLD.
17
+ * schema:
18
+ * type: string
19
+ * responses:
20
+ * 200:
21
+ * description: Success
22
+ */
23
+ AllDlRoutes.get('/api/v1/dl/tiktok', authenticateApiKey, apiLimiter, async (req, res) => {
24
+ try {
25
+ const url = req.query.url;
26
+ const response = await TiktokDownloader(url);
27
+ res.json(response);
28
+ } catch (error) {
29
+ res.status(401).json({ error: error.message });
30
+ }
31
+ });
32
+
33
+ export { AllDlRoutes };