randydev commited on
Commit
9de151e
·
verified ·
1 Parent(s): 52f47ec

Update plugins/alldownloader.js

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