Update plugins/alldownloader.js
Browse files- plugins/alldownloader.js +73 -0
plugins/alldownloader.js
CHANGED
@@ -16,6 +16,7 @@ import {
|
|
16 |
TeraboxDownloader,
|
17 |
TeraboxV2Downloader,
|
18 |
TeraboxV3Downloader,
|
|
|
19 |
XnxxDownloader,
|
20 |
XsearchDownloaderV2,
|
21 |
InstagramDownloader,
|
@@ -59,6 +60,78 @@ async function downloadMedia(media) {
|
|
59 |
}
|
60 |
}
|
61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
/**
|
63 |
* @swagger
|
64 |
* /api/v1/dl/twitter-v3:
|
|
|
16 |
TeraboxDownloader,
|
17 |
TeraboxV2Downloader,
|
18 |
TeraboxV3Downloader,
|
19 |
+
TeraboxV4Downloader,
|
20 |
XnxxDownloader,
|
21 |
XsearchDownloaderV2,
|
22 |
InstagramDownloader,
|
|
|
60 |
}
|
61 |
}
|
62 |
|
63 |
+
/**
|
64 |
+
* @swagger
|
65 |
+
* /api/v1/dl/terabox-v4:
|
66 |
+
* get:
|
67 |
+
* summary: Terabox V4 Downloader
|
68 |
+
* tags: [ALL-Downloader]
|
69 |
+
* parameters:
|
70 |
+
* - in: query
|
71 |
+
* name: url
|
72 |
+
* required: true
|
73 |
+
* description: null
|
74 |
+
* schema:
|
75 |
+
* type: string
|
76 |
+
* - in: header
|
77 |
+
* name: x-api-key
|
78 |
+
* required: true
|
79 |
+
* description: API key for authentication
|
80 |
+
* schema:
|
81 |
+
* type: string
|
82 |
+
* example: "lu api key di @aknuserbot telegram"
|
83 |
+
* responses:
|
84 |
+
* 200:
|
85 |
+
* description: Success
|
86 |
+
* 400:
|
87 |
+
* description: Bad Request (e.g., missing or invalid URL)
|
88 |
+
* 401:
|
89 |
+
* description: Unauthorized (e.g., missing or invalid API key)
|
90 |
+
* 500:
|
91 |
+
* description: Internal Server Error
|
92 |
+
*/
|
93 |
+
AllDlRoutes.get('/api/v1/dl/terabox-v4', async (req, res) => {
|
94 |
+
try {
|
95 |
+
const apiKey = req.headers['x-api-key'];
|
96 |
+
const userAgent = req.headers['user-agent'];
|
97 |
+
|
98 |
+
const xForwardedFor = req.headers['x-forwarded-for'];
|
99 |
+
const xRealIP = req.headers['x-real-ip'];
|
100 |
+
const cfConnectingIP = req.headers['cf-connecting-ip'];
|
101 |
+
|
102 |
+
let realIP = req.ip;
|
103 |
+
|
104 |
+
if (xForwardedFor) {
|
105 |
+
realIP = xForwardedFor.split(',')[0].trim();
|
106 |
+
} else if (xRealIP) {
|
107 |
+
realIP = xRealIP;
|
108 |
+
} else if (cfConnectingIP) {
|
109 |
+
realIP = cfConnectingIP;
|
110 |
+
}
|
111 |
+
|
112 |
+
req.realIP = realIP;
|
113 |
+
|
114 |
+
console.log(`🔍 Captured IPs:`, { xForwardedFor, xRealIP, cfConnectingIP, realIP });
|
115 |
+
|
116 |
+
const keyDoc = await db.findOne({ key: apiKey });
|
117 |
+
|
118 |
+
if (!keyDoc) {
|
119 |
+
return res.status(403).json({ error: "Invalid API Key." });
|
120 |
+
}
|
121 |
+
const q = req.query.url;
|
122 |
+
await updateIP(apiKey, realIP);
|
123 |
+
await TelegramUseLog(
|
124 |
+
keyDoc.owner,
|
125 |
+
keyDoc.key,
|
126 |
+
`Accessed: ${req.path}\nRealIP: ${realIP}\nUser-Agent: ${userAgent}`
|
127 |
+
);
|
128 |
+
const results = await TeraboxV4Downloader(q);
|
129 |
+
res.json({ message: results });
|
130 |
+
} catch (error) {
|
131 |
+
res.status(500).json({ error: error.message });
|
132 |
+
}
|
133 |
+
});
|
134 |
+
|
135 |
/**
|
136 |
* @swagger
|
137 |
* /api/v1/dl/twitter-v3:
|