File size: 908 Bytes
fc3dc85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import express from 'express';
import { TiktokDownloader } from '../lib/scrapper.js';
import { authenticateApiKey, apiLimiter } from '../middleware/midware.js';
const AllDlRoutes = express.Router();

/**
 * @swagger
 * /api/v1/dl/tiktok:
 *   get:
 *     summary: Tiktok Downloader
 *     tags: [ALL-Downloader]
 *     parameters:
 *       - in: query
 *         name: url
 *         required: true
 *         description: The query to be processed by the GPT OLD.
 *         schema:
 *           type: string
 *     responses:
 *       200:
 *         description: Success
 */
AllDlRoutes.get('/api/v1/dl/tiktok', authenticateApiKey, apiLimiter, async (req, res) => {
    try {
        const url = req.query.url;
        const response = await TiktokDownloader(url);
        res.json(response);
    } catch (error) {
        res.status(401).json({ error: error.message });
    }
});

export { AllDlRoutes };