Update plugins/alldownloader.js
Browse files- plugins/alldownloader.js +47 -0
plugins/alldownloader.js
CHANGED
@@ -6,6 +6,8 @@ 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 { youtubedl } from '../lib/youtube/youtube.js';
|
|
|
|
|
9 |
import { authenticateApiKey, apiLimiter } from '../middleware/midware.js';
|
10 |
const AllDlRoutes = express.Router();
|
11 |
|
@@ -40,6 +42,51 @@ async function downloadMedia(media) {
|
|
40 |
}
|
41 |
}
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
/**
|
45 |
* @swagger
|
|
|
6 |
import { snapsave } from '../lib/snapsave/snapsave.js';
|
7 |
import { tiktokdl } from '../lib/tiktok/tiktok.js';
|
8 |
import { youtubedl } from '../lib/youtube/youtube.js';
|
9 |
+
import { sfilemobi } from '../lib/sfilemobi/sfilemobi-dl.js';
|
10 |
+
import { sfilemobiSearch } from '../lib/sfilemobi/sfilemobisearch.js';
|
11 |
import { authenticateApiKey, apiLimiter } from '../middleware/midware.js';
|
12 |
const AllDlRoutes = express.Router();
|
13 |
|
|
|
42 |
}
|
43 |
}
|
44 |
|
45 |
+
/**
|
46 |
+
* @swagger
|
47 |
+
* /api/v1/dl/sfilemobi:
|
48 |
+
* get:
|
49 |
+
* summary: Sfilemobi Downloader
|
50 |
+
* tags: [ALL-Downloader]
|
51 |
+
* parameters:
|
52 |
+
* - in: query
|
53 |
+
* name: url
|
54 |
+
* required: true
|
55 |
+
* description: The URL of the TikTok video to be processed
|
56 |
+
* schema:
|
57 |
+
* type: string
|
58 |
+
* - in: header
|
59 |
+
* name: x-api-key
|
60 |
+
* required: true
|
61 |
+
* description: API key for authentication
|
62 |
+
* schema:
|
63 |
+
* type: string
|
64 |
+
* responses:
|
65 |
+
* 200:
|
66 |
+
* description: Success
|
67 |
+
* 400:
|
68 |
+
* description: Bad Request (e.g., missing or invalid URL)
|
69 |
+
* 401:
|
70 |
+
* description: Unauthorized (e.g., missing or invalid API key)
|
71 |
+
* 500:
|
72 |
+
* description: Internal Server Error
|
73 |
+
*/
|
74 |
+
AllDlRoutes.get('/api/v1/dl/sfilemobi', authenticateApiKey, apiLimiter, async (req, res) => {
|
75 |
+
try {
|
76 |
+
const url = req.query.url;
|
77 |
+
|
78 |
+
if (!url) {
|
79 |
+
return res.status(400).json({ error: "URL parameter is required." });
|
80 |
+
}
|
81 |
+
|
82 |
+
const results = await sfilemobi(url);
|
83 |
+
res.json({ results });
|
84 |
+
} catch (error) {
|
85 |
+
res.status(500).json({ error: error.message });
|
86 |
+
}
|
87 |
+
});
|
88 |
+
|
89 |
+
|
90 |
|
91 |
/**
|
92 |
* @swagger
|