randydev commited on
Commit
2742468
·
verified ·
1 Parent(s): 6249af5

Update plugins/alldownloader.js

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