Update plugins/alldownloader.js
Browse files- plugins/alldownloader.js +45 -1
plugins/alldownloader.js
CHANGED
@@ -16,7 +16,8 @@ import {
|
|
16 |
InstagramDownloader,
|
17 |
TeraboxDownloader,
|
18 |
TeraboxV2Downloader,
|
19 |
-
PinterestDownloader
|
|
|
20 |
} from '../lib/all.js';
|
21 |
|
22 |
import { authenticateApiKey, apiLimiter } from '../middleware/midware.js';
|
@@ -53,6 +54,49 @@ async function downloadMedia(media) {
|
|
53 |
}
|
54 |
}
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
/**
|
57 |
* @swagger
|
58 |
* /api/v1/dl/pint:
|
|
|
16 |
InstagramDownloader,
|
17 |
TeraboxDownloader,
|
18 |
TeraboxV2Downloader,
|
19 |
+
PinterestDownloader,
|
20 |
+
InstagramDLV2,
|
21 |
} from '../lib/all.js';
|
22 |
|
23 |
import { authenticateApiKey, apiLimiter } from '../middleware/midware.js';
|
|
|
54 |
}
|
55 |
}
|
56 |
|
57 |
+
/**
|
58 |
+
* @swagger
|
59 |
+
* /api/v1/dl/instagram-v2:
|
60 |
+
* get:
|
61 |
+
* summary: Instagram V2 Downloader
|
62 |
+
* tags: [ALL-Downloader]
|
63 |
+
* parameters:
|
64 |
+
* - in: query
|
65 |
+
* name: url
|
66 |
+
* required: true
|
67 |
+
* description: null
|
68 |
+
* schema:
|
69 |
+
* type: string
|
70 |
+
* - in: header
|
71 |
+
* name: x-api-key
|
72 |
+
* required: true
|
73 |
+
* description: API key for authentication
|
74 |
+
* schema:
|
75 |
+
* type: string
|
76 |
+
* responses:
|
77 |
+
* 200:
|
78 |
+
* description: Success
|
79 |
+
* 400:
|
80 |
+
* description: Bad Request (e.g., missing or invalid URL)
|
81 |
+
* 401:
|
82 |
+
* description: Unauthorized (e.g., missing or invalid API key)
|
83 |
+
* 500:
|
84 |
+
* description: Internal Server Error
|
85 |
+
*/
|
86 |
+
AllDlRoutes.get('/api/v1/dl/pint', authenticateApiKey, apiLimiter, async (req, res) => {
|
87 |
+
try {
|
88 |
+
const q = req.query.url;
|
89 |
+
|
90 |
+
if (!q) {
|
91 |
+
return res.status(400).json({ error: "URL parameter is required." });
|
92 |
+
}
|
93 |
+
const results = await InstagramDLV2(q);
|
94 |
+
res.json({ results });
|
95 |
+
} catch (error) {
|
96 |
+
res.status(500).json({ error: error.message });
|
97 |
+
}
|
98 |
+
});
|
99 |
+
|
100 |
/**
|
101 |
* @swagger
|
102 |
* /api/v1/dl/pint:
|