randydev commited on
Commit
74c1727
·
verified ·
1 Parent(s): 447b34c

Update plugins/alldownloader.js

Browse files
Files changed (1) hide show
  1. plugins/alldownloader.js +46 -0
plugins/alldownloader.js CHANGED
@@ -4,6 +4,7 @@ import { facebookdl } from '../lib/facebook/facebook.js';
4
  import { savefrom } from '../lib/savefrom/savefrom.js';
5
  import { mediafiredl } from '../lib/mediafire/mediafire.js';
6
  import { snapsave } from '../lib/snapsave/snapsave.js';
 
7
  import { authenticateApiKey, apiLimiter } from '../middleware/midware.js';
8
  const AllDlRoutes = express.Router();
9
 
@@ -51,6 +52,51 @@ AllDlRoutes.get('/api/v1/dl/tiktok', authenticateApiKey, apiLimiter, async (req,
51
  }
52
  });
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  /**
55
  * @swagger
56
  * /api/v1/dl/fb:
 
4
  import { savefrom } from '../lib/savefrom/savefrom.js';
5
  import { mediafiredl } from '../lib/mediafire/mediafire.js';
6
  import { snapsave } from '../lib/snapsave/snapsave.js';
7
+ import { tiktokdl } from '../lib/tiktok/tiktok.js';
8
  import { authenticateApiKey, apiLimiter } from '../middleware/midware.js';
9
  const AllDlRoutes = express.Router();
10
 
 
52
  }
53
  });
54
 
55
+
56
+ /**
57
+ * @swagger
58
+ * /api/v1/dl/tiktok-v2:
59
+ * get:
60
+ * summary: Tiktok V2 Downloader
61
+ * tags: [ALL-Downloader]
62
+ * parameters:
63
+ * - in: query
64
+ * name: url
65
+ * required: true
66
+ * description: The URL of the TikTok video to be processed
67
+ * schema:
68
+ * type: string
69
+ * - in: header
70
+ * name: x-api-key
71
+ * required: true
72
+ * description: API key for authentication
73
+ * schema:
74
+ * type: string
75
+ * responses:
76
+ * 200:
77
+ * description: Success
78
+ * 400:
79
+ * description: Bad Request (e.g., missing or invalid URL)
80
+ * 401:
81
+ * description: Unauthorized (e.g., missing or invalid API key)
82
+ * 500:
83
+ * description: Internal Server Error
84
+ */
85
+ AllDlRoutes.get('/api/v1/dl/tiktok-v2', authenticateApiKey, apiLimiter, async (req, res) => {
86
+ try {
87
+ const url = req.query.url;
88
+
89
+ if (!url) {
90
+ return res.status(400).json({ error: "URL parameter is required." });
91
+ }
92
+
93
+ const results = await tiktokdl(url);
94
+ res.json({ results });
95
+ } catch (error) {
96
+ res.status(500).json({ error: error.message });
97
+ }
98
+ });
99
+
100
  /**
101
  * @swagger
102
  * /api/v1/dl/fb: