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