randydev commited on
Commit
a98e42a
·
verified ·
1 Parent(s): f2517e5

Update plugins/alldownloader.js

Browse files
Files changed (1) hide show
  1. plugins/alldownloader.js +45 -1
plugins/alldownloader.js CHANGED
@@ -9,7 +9,8 @@ import {
9
  sfilemobi,
10
  sfilemobiSearch,
11
  TiktokDownloader,
12
- XnxxDownloader
 
13
  } from '../lib/all.js';
14
 
15
  import { authenticateApiKey, apiLimiter } from '../middleware/midware.js';
@@ -90,6 +91,49 @@ AllDlRoutes.get('/api/v1/dl/sfilemobi-search', authenticateApiKey, apiLimiter, a
90
  }
91
  });
92
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
 
94
  /**
95
  * @swagger
 
9
  sfilemobi,
10
  sfilemobiSearch,
11
  TiktokDownloader,
12
+ XnxxDownloader,
13
+ TwitterDownloader
14
  } from '../lib/all.js';
15
 
16
  import { authenticateApiKey, apiLimiter } from '../middleware/midware.js';
 
91
  }
92
  });
93
 
94
+ /**
95
+ * @swagger
96
+ * /api/v1/dl/twitter:
97
+ * get:
98
+ * summary: Twitter Downloader
99
+ * tags: [ALL-Downloader]
100
+ * parameters:
101
+ * - in: query
102
+ * name: url
103
+ * required: true
104
+ * description: null
105
+ * schema:
106
+ * type: string
107
+ * - in: header
108
+ * name: x-api-key
109
+ * required: true
110
+ * description: API key for authentication
111
+ * schema:
112
+ * type: string
113
+ * responses:
114
+ * 200:
115
+ * description: Success
116
+ * 400:
117
+ * description: Bad Request (e.g., missing or invalid URL)
118
+ * 401:
119
+ * description: Unauthorized (e.g., missing or invalid API key)
120
+ * 500:
121
+ * description: Internal Server Error
122
+ */
123
+ AllDlRoutes.get('/api/v1/dl/twitter', authenticateApiKey, apiLimiter, async (req, res) => {
124
+ try {
125
+ const url = req.query.url;
126
+
127
+ if (!url) {
128
+ return res.status(400).json({ error: "URL parameter is required." });
129
+ }
130
+
131
+ const results = await TwitterDownloader(url);
132
+ res.json({ results });
133
+ } catch (error) {
134
+ res.status(500).json({ error: error.message });
135
+ }
136
+ });
137
 
138
  /**
139
  * @swagger