randydev commited on
Commit
216a7bf
·
verified ·
1 Parent(s): a7b9a55

Upload alldownloader.js

Browse files
Files changed (1) hide show
  1. plugins/alldownloader.js +0 -659
plugins/alldownloader.js CHANGED
@@ -40,7 +40,6 @@ async function updateIP(apiKey, newIP) {
40
  );
41
  }
42
 
43
-
44
  async function downloadMedia(media) {
45
  const downloadResults = {};
46
  try {
@@ -92,39 +91,7 @@ async function downloadMedia(media) {
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) {
@@ -164,39 +131,7 @@ AllDlRoutes.get('/api/v1/dl/terabox-v4', async (req, res) => {
164
  */
165
  AllDlRoutes.get('/api/v1/dl/twitter-v3', async (req, res) => {
166
  try {
167
- const apiKey = req.headers['x-api-key'];
168
- const userAgent = req.headers['user-agent'];
169
-
170
- const xForwardedFor = req.headers['x-forwarded-for'];
171
- const xRealIP = req.headers['x-real-ip'];
172
- const cfConnectingIP = req.headers['cf-connecting-ip'];
173
-
174
- let realIP = req.ip;
175
-
176
- if (xForwardedFor) {
177
- realIP = xForwardedFor.split(',')[0].trim();
178
- } else if (xRealIP) {
179
- realIP = xRealIP;
180
- } else if (cfConnectingIP) {
181
- realIP = cfConnectingIP;
182
- }
183
-
184
- req.realIP = realIP;
185
-
186
- console.log(`🔍 Captured IPs:`, { xForwardedFor, xRealIP, cfConnectingIP, realIP });
187
-
188
- const keyDoc = await db.findOne({ key: apiKey });
189
-
190
- if (!keyDoc) {
191
- return res.status(403).json({ error: "Invalid API Key." });
192
- }
193
  const q = req.query.url;
194
- await updateIP(apiKey, realIP);
195
- await TelegramUseLog(
196
- keyDoc.owner,
197
- keyDoc.key,
198
- `Accessed: ${req.path}\nRealIP: ${realIP}\nUser-Agent: ${userAgent}`
199
- );
200
  const results = await TwitterDownloderV3(q);
201
  res.json({ message: results });
202
  } catch (error) {
@@ -236,39 +171,7 @@ AllDlRoutes.get('/api/v1/dl/twitter-v3', async (req, res) => {
236
  */
237
  AllDlRoutes.get('/api/v1/dl/twitter-v2', async (req, res) => {
238
  try {
239
- const apiKey = req.headers['x-api-key'];
240
- const userAgent = req.headers['user-agent'];
241
-
242
- const xForwardedFor = req.headers['x-forwarded-for'];
243
- const xRealIP = req.headers['x-real-ip'];
244
- const cfConnectingIP = req.headers['cf-connecting-ip'];
245
-
246
- let realIP = req.ip;
247
-
248
- if (xForwardedFor) {
249
- realIP = xForwardedFor.split(',')[0].trim();
250
- } else if (xRealIP) {
251
- realIP = xRealIP;
252
- } else if (cfConnectingIP) {
253
- realIP = cfConnectingIP;
254
- }
255
-
256
- req.realIP = realIP;
257
-
258
- console.log(`🔍 Captured IPs:`, { xForwardedFor, xRealIP, cfConnectingIP, realIP });
259
-
260
- const keyDoc = await db.findOne({ key: apiKey });
261
-
262
- if (!keyDoc) {
263
- return res.status(403).json({ error: "Invalid API Key." });
264
- }
265
  const q = req.query.url;
266
- await updateIP(apiKey, realIP);
267
- await TelegramUseLog(
268
- keyDoc.owner,
269
- keyDoc.key,
270
- `Accessed: ${req.path}\nRealIP: ${realIP}\nUser-Agent: ${userAgent}`
271
- );
272
  const results = await TwitterDownloaderV2(q);
273
  res.json({ message: results });
274
  } catch (error) {
@@ -308,43 +211,10 @@ AllDlRoutes.get('/api/v1/dl/twitter-v2', async (req, res) => {
308
  */
309
  AllDlRoutes.get('/api/v1/dl/xnxx-info-v2', authenticateApiKey, apiLimiter, async (req, res) => {
310
  try {
311
- const apiKey = req.headers['x-api-key'];
312
- const userAgent = req.headers['user-agent'];
313
-
314
- const xForwardedFor = req.headers['x-forwarded-for'];
315
- const xRealIP = req.headers['x-real-ip'];
316
- const cfConnectingIP = req.headers['cf-connecting-ip'];
317
-
318
- let realIP = req.ip;
319
-
320
- if (xForwardedFor) {
321
- realIP = xForwardedFor.split(',')[0].trim();
322
- } else if (xRealIP) {
323
- realIP = xRealIP;
324
- } else if (cfConnectingIP) {
325
- realIP = cfConnectingIP;
326
- }
327
-
328
- req.realIP = realIP;
329
-
330
- console.log(`🔍 Captured IPs:`, { xForwardedFor, xRealIP, cfConnectingIP, realIP });
331
-
332
- const keyDoc = await db.findOne({ key: apiKey });
333
-
334
- if (!keyDoc) {
335
- return res.status(403).json({ error: "Invalid API Key." });
336
- }
337
  const q = req.query.url;
338
-
339
  if (!q) {
340
  return res.status(400).json({ error: "url parameter is required." });
341
  }
342
- await updateIP(apiKey, realIP);
343
- await TelegramUseLog(
344
- keyDoc.owner,
345
- keyDoc.key,
346
- `Accessed: ${req.path}\nRealIP: ${realIP}\nUser-Agent: ${userAgent}`
347
- );
348
  const results = await XInfoDownloaderV2(q);
349
  res.json({ message: results });
350
  } catch (error) {
@@ -384,42 +254,10 @@ AllDlRoutes.get('/api/v1/dl/xnxx-info-v2', authenticateApiKey, apiLimiter, async
384
  */
385
  AllDlRoutes.get('/api/v1/dl/xnxx-search-v2', authenticateApiKey, apiLimiter, async (req, res) => {
386
  try {
387
- const apiKey = req.headers['x-api-key'];
388
- const userAgent = req.headers['user-agent'];
389
-
390
- const xForwardedFor = req.headers['x-forwarded-for'];
391
- const xRealIP = req.headers['x-real-ip'];
392
- const cfConnectingIP = req.headers['cf-connecting-ip'];
393
-
394
- let realIP = req.ip;
395
-
396
- if (xForwardedFor) {
397
- realIP = xForwardedFor.split(',')[0].trim();
398
- } else if (xRealIP) {
399
- realIP = xRealIP;
400
- } else if (cfConnectingIP) {
401
- realIP = cfConnectingIP;
402
- }
403
-
404
- req.realIP = realIP;
405
-
406
- console.log(`🔍 Captured IPs:`, { xForwardedFor, xRealIP, cfConnectingIP, realIP });
407
-
408
- const keyDoc = await db.findOne({ key: apiKey });
409
-
410
- if (!keyDoc) {
411
- return res.status(403).json({ error: "Invalid API Key." });
412
- }
413
  const q = req.query.q;
414
  if (!q) {
415
  return res.status(400).json({ error: "q parameter is required." });
416
  }
417
- await updateIP(apiKey, realIP);
418
- await TelegramUseLog(
419
- keyDoc.owner,
420
- keyDoc.key,
421
- `Accessed: ${req.path}\nRealIP: ${realIP}\nUser-Agent: ${userAgent}`
422
- );
423
  const results = await XsearchDownloaderV2(q);
424
  res.json({ message: results });
425
  // console.dir(testings);
@@ -460,43 +298,10 @@ AllDlRoutes.get('/api/v1/dl/xnxx-search-v2', authenticateApiKey, apiLimiter, asy
460
  */
461
  AllDlRoutes.get('/api/v1/dl/instagram-v4', authenticateApiKey, apiLimiter, async (req, res) => {
462
  try {
463
- const apiKey = req.headers['x-api-key'];
464
- const userAgent = req.headers['user-agent'];
465
-
466
- const xForwardedFor = req.headers['x-forwarded-for'];
467
- const xRealIP = req.headers['x-real-ip'];
468
- const cfConnectingIP = req.headers['cf-connecting-ip'];
469
-
470
- let realIP = req.ip;
471
-
472
- if (xForwardedFor) {
473
- realIP = xForwardedFor.split(',')[0].trim();
474
- } else if (xRealIP) {
475
- realIP = xRealIP;
476
- } else if (cfConnectingIP) {
477
- realIP = cfConnectingIP;
478
- }
479
-
480
- req.realIP = realIP;
481
-
482
- console.log(`🔍 Captured IPs:`, { xForwardedFor, xRealIP, cfConnectingIP, realIP });
483
-
484
- const keyDoc = await db.findOne({ key: apiKey });
485
-
486
- if (!keyDoc) {
487
- return res.status(403).json({ error: "Invalid API Key." });
488
- }
489
  const q = req.query.url;
490
-
491
  if (!q) {
492
  return res.status(400).json({ error: "URL parameter is required." });
493
  }
494
- await updateIP(apiKey, realIP);
495
- await TelegramUseLog(
496
- keyDoc.owner,
497
- keyDoc.key,
498
- `Accessed: ${req.path}\nRealIP: ${realIP}\nUser-Agent: ${userAgent}`
499
- );
500
  const results = await InstagramDLV4(q);
501
  res.json({ results });
502
  } catch (error) {
@@ -537,42 +342,10 @@ AllDlRoutes.get('/api/v1/dl/instagram-v4', authenticateApiKey, apiLimiter, async
537
  */
538
  AllDlRoutes.get('/api/v1/dl/instagram-v3', authenticateApiKey, apiLimiter, async (req, res) => {
539
  try {
540
- const apiKey = req.headers['x-api-key'];
541
- const userAgent = req.headers['user-agent'];
542
-
543
- const xForwardedFor = req.headers['x-forwarded-for'];
544
- const xRealIP = req.headers['x-real-ip'];
545
- const cfConnectingIP = req.headers['cf-connecting-ip'];
546
-
547
- let realIP = req.ip;
548
-
549
- if (xForwardedFor) {
550
- realIP = xForwardedFor.split(',')[0].trim();
551
- } else if (xRealIP) {
552
- realIP = xRealIP;
553
- } else if (cfConnectingIP) {
554
- realIP = cfConnectingIP;
555
- }
556
-
557
- req.realIP = realIP;
558
-
559
- console.log(`🔍 Captured IPs:`, { xForwardedFor, xRealIP, cfConnectingIP, realIP });
560
-
561
- const keyDoc = await db.findOne({ key: apiKey });
562
-
563
- if (!keyDoc) {
564
- return res.status(403).json({ error: "Invalid API Key." });
565
- }
566
  const q = req.query.url;
567
  if (!q) {
568
  return res.status(400).json({ error: "URL parameter is required." });
569
  }
570
- await updateIP(apiKey, realIP);
571
- await TelegramUseLog(
572
- keyDoc.owner,
573
- keyDoc.key,
574
- `Accessed: ${req.path}\nRealIP: ${realIP}\nUser-Agent: ${userAgent}`
575
- );
576
  const results = await InstagramDLV3(q);
577
  res.json({ results });
578
  } catch (error) {
@@ -612,43 +385,10 @@ AllDlRoutes.get('/api/v1/dl/instagram-v3', authenticateApiKey, apiLimiter, async
612
  */
613
  AllDlRoutes.get('/api/v1/dl/instagram-v2', authenticateApiKey, apiLimiter, async (req, res) => {
614
  try {
615
- const apiKey = req.headers['x-api-key'];
616
- const userAgent = req.headers['user-agent'];
617
-
618
- const xForwardedFor = req.headers['x-forwarded-for'];
619
- const xRealIP = req.headers['x-real-ip'];
620
- const cfConnectingIP = req.headers['cf-connecting-ip'];
621
-
622
- let realIP = req.ip;
623
-
624
- if (xForwardedFor) {
625
- realIP = xForwardedFor.split(',')[0].trim();
626
- } else if (xRealIP) {
627
- realIP = xRealIP;
628
- } else if (cfConnectingIP) {
629
- realIP = cfConnectingIP;
630
- }
631
-
632
- req.realIP = realIP;
633
-
634
- console.log(`🔍 Captured IPs:`, { xForwardedFor, xRealIP, cfConnectingIP, realIP });
635
-
636
- const keyDoc = await db.findOne({ key: apiKey });
637
-
638
- if (!keyDoc) {
639
- return res.status(403).json({ error: "Invalid API Key." });
640
- }
641
  const q = req.query.url;
642
-
643
  if (!q) {
644
  return res.status(400).json({ error: "URL parameter is required." });
645
  }
646
- await updateIP(apiKey, realIP);
647
- await TelegramUseLog(
648
- keyDoc.owner,
649
- keyDoc.key,
650
- `Accessed: ${req.path}\nRealIP: ${realIP}\nUser-Agent: ${userAgent}`
651
- );
652
  const results = await InstagramDLV2(q);
653
  res.json({ results });
654
  } catch (error) {
@@ -688,43 +428,10 @@ AllDlRoutes.get('/api/v1/dl/instagram-v2', authenticateApiKey, apiLimiter, async
688
  */
689
  AllDlRoutes.get('/api/v1/dl/pint', authenticateApiKey, apiLimiter, async (req, res) => {
690
  try {
691
- const apiKey = req.headers['x-api-key'];
692
- const userAgent = req.headers['user-agent'];
693
-
694
- const xForwardedFor = req.headers['x-forwarded-for'];
695
- const xRealIP = req.headers['x-real-ip'];
696
- const cfConnectingIP = req.headers['cf-connecting-ip'];
697
-
698
- let realIP = req.ip;
699
-
700
- if (xForwardedFor) {
701
- realIP = xForwardedFor.split(',')[0].trim();
702
- } else if (xRealIP) {
703
- realIP = xRealIP;
704
- } else if (cfConnectingIP) {
705
- realIP = cfConnectingIP;
706
- }
707
-
708
- req.realIP = realIP;
709
-
710
- console.log(`🔍 Captured IPs:`, { xForwardedFor, xRealIP, cfConnectingIP, realIP });
711
-
712
- const keyDoc = await db.findOne({ key: apiKey });
713
-
714
- if (!keyDoc) {
715
- return res.status(403).json({ error: "Invalid API Key." });
716
- }
717
  const q = req.query.q;
718
-
719
  if (!q) {
720
  return res.status(400).json({ error: "URL parameter is required." });
721
  }
722
- await updateIP(apiKey, realIP);
723
- await TelegramUseLog(
724
- keyDoc.owner,
725
- keyDoc.key,
726
- `Accessed: ${req.path}\nRealIP: ${realIP}\nUser-Agent: ${userAgent}`
727
- );
728
  const results = await PinterestDL(q);
729
  res.json({ results });
730
  } catch (error) {
@@ -765,43 +472,10 @@ AllDlRoutes.get('/api/v1/dl/pint', authenticateApiKey, apiLimiter, async (req, r
765
  */
766
  AllDlRoutes.get('/api/v1/dl/sfilemobi-search', authenticateApiKey, apiLimiter, async (req, res) => {
767
  try {
768
- const apiKey = req.headers['x-api-key'];
769
- const userAgent = req.headers['user-agent'];
770
-
771
- const xForwardedFor = req.headers['x-forwarded-for'];
772
- const xRealIP = req.headers['x-real-ip'];
773
- const cfConnectingIP = req.headers['cf-connecting-ip'];
774
-
775
- let realIP = req.ip;
776
-
777
- if (xForwardedFor) {
778
- realIP = xForwardedFor.split(',')[0].trim();
779
- } else if (xRealIP) {
780
- realIP = xRealIP;
781
- } else if (cfConnectingIP) {
782
- realIP = cfConnectingIP;
783
- }
784
-
785
- req.realIP = realIP;
786
-
787
- console.log(`🔍 Captured IPs:`, { xForwardedFor, xRealIP, cfConnectingIP, realIP });
788
-
789
- const keyDoc = await db.findOne({ key: apiKey });
790
-
791
- if (!keyDoc) {
792
- return res.status(403).json({ error: "Invalid API Key." });
793
- }
794
  const q = req.query.q;
795
-
796
  if (!q) {
797
  return res.status(400).json({ error: "URL parameter is required." });
798
  }
799
- await updateIP(apiKey, realIP);
800
- await TelegramUseLog(
801
- keyDoc.owner,
802
- keyDoc.key,
803
- `Accessed: ${req.path}\nRealIP: ${realIP}\nUser-Agent: ${userAgent}`
804
- );
805
  const results = await sfilemobiSearch(q);
806
  res.json({ results });
807
  } catch (error) {
@@ -979,43 +653,10 @@ AllDlRoutes.get('/api/v1/dl/sfilemobi-search', authenticateApiKey, apiLimiter, a
979
  */
980
  AllDlRoutes.get('/api/v1/dl/capcut', authenticateApiKey, apiLimiter, async (req, res) => {
981
  try {
982
- const apiKey = req.headers['x-api-key'];
983
- const userAgent = req.headers['user-agent'];
984
-
985
- const xForwardedFor = req.headers['x-forwarded-for'];
986
- const xRealIP = req.headers['x-real-ip'];
987
- const cfConnectingIP = req.headers['cf-connecting-ip'];
988
-
989
- let realIP = req.ip;
990
-
991
- if (xForwardedFor) {
992
- realIP = xForwardedFor.split(',')[0].trim();
993
- } else if (xRealIP) {
994
- realIP = xRealIP;
995
- } else if (cfConnectingIP) {
996
- realIP = cfConnectingIP;
997
- }
998
-
999
- req.realIP = realIP;
1000
-
1001
- console.log(`🔍 Captured IPs:`, { xForwardedFor, xRealIP, cfConnectingIP, realIP });
1002
-
1003
- const keyDoc = await db.findOne({ key: apiKey });
1004
-
1005
- if (!keyDoc) {
1006
- return res.status(403).json({ error: "Invalid API Key." });
1007
- }
1008
  const url = req.query.url;
1009
-
1010
  if (!url) {
1011
  return res.status(400).json({ error: "URL parameter is required." });
1012
  }
1013
- await updateIP(apiKey, realIP);
1014
- await TelegramUseLog(
1015
- keyDoc.owner,
1016
- keyDoc.key,
1017
- `Accessed: ${req.path}\nRealIP: ${realIP}\nUser-Agent: ${userAgent}`
1018
- );
1019
  const results = capcutdl(url);
1020
  res.json({ results });
1021
  } catch (error) {
@@ -1056,43 +697,10 @@ AllDlRoutes.get('/api/v1/dl/capcut', authenticateApiKey, apiLimiter, async (req,
1056
  */
1057
  AllDlRoutes.get('/api/v1/dl/instagram', authenticateApiKey, apiLimiter, async (req, res) => {
1058
  try {
1059
- const apiKey = req.headers['x-api-key'];
1060
- const userAgent = req.headers['user-agent'];
1061
-
1062
- const xForwardedFor = req.headers['x-forwarded-for'];
1063
- const xRealIP = req.headers['x-real-ip'];
1064
- const cfConnectingIP = req.headers['cf-connecting-ip'];
1065
-
1066
- let realIP = req.ip;
1067
-
1068
- if (xForwardedFor) {
1069
- realIP = xForwardedFor.split(',')[0].trim();
1070
- } else if (xRealIP) {
1071
- realIP = xRealIP;
1072
- } else if (cfConnectingIP) {
1073
- realIP = cfConnectingIP;
1074
- }
1075
-
1076
- req.realIP = realIP;
1077
-
1078
- console.log(`🔍 Captured IPs:`, { xForwardedFor, xRealIP, cfConnectingIP, realIP });
1079
-
1080
- const keyDoc = await db.findOne({ key: apiKey });
1081
-
1082
- if (!keyDoc) {
1083
- return res.status(403).json({ error: "Invalid API Key." });
1084
- }
1085
  const url = req.query.url;
1086
-
1087
  if (!url) {
1088
  return res.status(400).json({ error: "URL parameter is required." });
1089
  }
1090
- await updateIP(apiKey, realIP);
1091
- await TelegramUseLog(
1092
- keyDoc.owner,
1093
- keyDoc.key,
1094
- `Accessed: ${req.path}\nRealIP: ${realIP}\nUser-Agent: ${userAgent}`
1095
- );
1096
  const results = await InstagramDownloader(url);
1097
  res.json({ results });
1098
  } catch (error) {
@@ -1132,43 +740,11 @@ AllDlRoutes.get('/api/v1/dl/instagram', authenticateApiKey, apiLimiter, async (r
1132
  */
1133
  AllDlRoutes.get('/api/v1/dl/twitter', authenticateApiKey, apiLimiter, async (req, res) => {
1134
  try {
1135
- const apiKey = req.headers['x-api-key'];
1136
- const userAgent = req.headers['user-agent'];
1137
-
1138
- const xForwardedFor = req.headers['x-forwarded-for'];
1139
- const xRealIP = req.headers['x-real-ip'];
1140
- const cfConnectingIP = req.headers['cf-connecting-ip'];
1141
-
1142
- let realIP = req.ip;
1143
-
1144
- if (xForwardedFor) {
1145
- realIP = xForwardedFor.split(',')[0].trim();
1146
- } else if (xRealIP) {
1147
- realIP = xRealIP;
1148
- } else if (cfConnectingIP) {
1149
- realIP = cfConnectingIP;
1150
- }
1151
-
1152
- req.realIP = realIP;
1153
-
1154
- console.log(`🔍 Captured IPs:`, { xForwardedFor, xRealIP, cfConnectingIP, realIP });
1155
-
1156
- const keyDoc = await db.findOne({ key: apiKey });
1157
-
1158
- if (!keyDoc) {
1159
- return res.status(403).json({ error: "Invalid API Key." });
1160
- }
1161
  const url = req.query.url;
1162
 
1163
  if (!url) {
1164
  return res.status(400).json({ error: "URL parameter is required." });
1165
  }
1166
- await updateIP(apiKey, realIP);
1167
- await TelegramUseLog(
1168
- keyDoc.owner,
1169
- keyDoc.key,
1170
- `Accessed: ${req.path}\nRealIP: ${realIP}\nUser-Agent: ${userAgent}`
1171
- );
1172
  const results = await TwitterDownloader(url);
1173
  res.json({ results });
1174
  } catch (error) {
@@ -1208,43 +784,10 @@ AllDlRoutes.get('/api/v1/dl/twitter', authenticateApiKey, apiLimiter, async (req
1208
  */
1209
  AllDlRoutes.get('/api/v1/dl/sfilemobi', authenticateApiKey, apiLimiter, async (req, res) => {
1210
  try {
1211
- const apiKey = req.headers['x-api-key'];
1212
- const userAgent = req.headers['user-agent'];
1213
-
1214
- const xForwardedFor = req.headers['x-forwarded-for'];
1215
- const xRealIP = req.headers['x-real-ip'];
1216
- const cfConnectingIP = req.headers['cf-connecting-ip'];
1217
-
1218
- let realIP = req.ip;
1219
-
1220
- if (xForwardedFor) {
1221
- realIP = xForwardedFor.split(',')[0].trim();
1222
- } else if (xRealIP) {
1223
- realIP = xRealIP;
1224
- } else if (cfConnectingIP) {
1225
- realIP = cfConnectingIP;
1226
- }
1227
-
1228
- req.realIP = realIP;
1229
-
1230
- console.log(`🔍 Captured IPs:`, { xForwardedFor, xRealIP, cfConnectingIP, realIP });
1231
-
1232
- const keyDoc = await db.findOne({ key: apiKey });
1233
-
1234
- if (!keyDoc) {
1235
- return res.status(403).json({ error: "Invalid API Key." });
1236
- }
1237
  const url = req.query.url;
1238
-
1239
  if (!url) {
1240
  return res.status(400).json({ error: "URL parameter is required." });
1241
  }
1242
- await updateIP(apiKey, realIP);
1243
- await TelegramUseLog(
1244
- keyDoc.owner,
1245
- keyDoc.key,
1246
- `Accessed: ${req.path}\nRealIP: ${realIP}\nUser-Agent: ${userAgent}`
1247
- );
1248
  const results = await sfilemobi(url);
1249
  res.json({ results });
1250
  } catch (error) {
@@ -1284,43 +827,10 @@ AllDlRoutes.get('/api/v1/dl/sfilemobi', authenticateApiKey, apiLimiter, async (r
1284
  */
1285
  AllDlRoutes.get('/api/v1/dl/tiktok', authenticateApiKey, apiLimiter, async (req, res) => {
1286
  try {
1287
- const apiKey = req.headers['x-api-key'];
1288
- const userAgent = req.headers['user-agent'];
1289
-
1290
- const xForwardedFor = req.headers['x-forwarded-for'];
1291
- const xRealIP = req.headers['x-real-ip'];
1292
- const cfConnectingIP = req.headers['cf-connecting-ip'];
1293
-
1294
- let realIP = req.ip;
1295
-
1296
- if (xForwardedFor) {
1297
- realIP = xForwardedFor.split(',')[0].trim();
1298
- } else if (xRealIP) {
1299
- realIP = xRealIP;
1300
- } else if (cfConnectingIP) {
1301
- realIP = cfConnectingIP;
1302
- }
1303
-
1304
- req.realIP = realIP;
1305
-
1306
- console.log(`🔍 Captured IPs:`, { xForwardedFor, xRealIP, cfConnectingIP, realIP });
1307
-
1308
- const keyDoc = await db.findOne({ key: apiKey });
1309
-
1310
- if (!keyDoc) {
1311
- return res.status(403).json({ error: "Invalid API Key." });
1312
- }
1313
  const url = req.query.url;
1314
-
1315
  if (!url) {
1316
  return res.status(400).json({ error: "URL parameter is required." });
1317
  }
1318
- await updateIP(apiKey, realIP);
1319
- await TelegramUseLog(
1320
- keyDoc.owner,
1321
- keyDoc.key,
1322
- `Accessed: ${req.path}\nRealIP: ${realIP}\nUser-Agent: ${userAgent}`
1323
- );
1324
  const results = await TiktokDownloader(url);
1325
  res.json({ results });
1326
  } catch (error) {
@@ -1360,45 +870,10 @@ AllDlRoutes.get('/api/v1/dl/tiktok', authenticateApiKey, apiLimiter, async (req,
1360
  */
1361
  AllDlRoutes.get('/api/v1/dl/tiktok-v2', authenticateApiKey, apiLimiter, async (req, res) => {
1362
  try {
1363
- const apiKey = req.headers['x-api-key'];
1364
- const userAgent = req.headers['user-agent'];
1365
-
1366
- const xForwardedFor = req.headers['x-forwarded-for'];
1367
- const xRealIP = req.headers['x-real-ip'];
1368
- const cfConnectingIP = req.headers['cf-connecting-ip'];
1369
-
1370
- let realIP = req.ip;
1371
-
1372
- if (xForwardedFor) {
1373
- realIP = xForwardedFor.split(',')[0].trim();
1374
- } else if (xRealIP) {
1375
- realIP = xRealIP;
1376
- } else if (cfConnectingIP) {
1377
- realIP = cfConnectingIP;
1378
- }
1379
-
1380
- req.realIP = realIP;
1381
-
1382
- console.log(`🔍 Captured IPs:`, { xForwardedFor, xRealIP, cfConnectingIP, realIP });
1383
-
1384
- const keyDoc = await db.findOne({ key: apiKey });
1385
-
1386
- if (!keyDoc) {
1387
- return res.status(403).json({ error: "Invalid API Key." });
1388
- }
1389
-
1390
  const url = req.query.url;
1391
  if (!url) {
1392
  return res.status(400).json({ error: "URL parameter is required." });
1393
  }
1394
-
1395
- await updateIP(apiKey, realIP);
1396
- await TelegramUseLog(
1397
- keyDoc.owner,
1398
- keyDoc.key,
1399
- `Accessed: ${req.path}\nRealIP: ${realIP}\nUser-Agent: ${userAgent}`
1400
- );
1401
-
1402
  const results = await tiktokdl(url);
1403
  res.json({ results });
1404
 
@@ -1440,38 +915,10 @@ AllDlRoutes.get('/api/v1/dl/tiktok-v2', authenticateApiKey, apiLimiter, async (r
1440
  */
1441
  AllDlRoutes.get('/api/v1/dl/fb', authenticateApiKey, apiLimiter, async (req, res) => {
1442
  try {
1443
- const apiKey = req.headers['x-api-key'];
1444
- const userAgent = req.headers['user-agent'];
1445
-
1446
- const xForwardedFor = req.headers['x-forwarded-for'];
1447
- const xRealIP = req.headers['x-real-ip'];
1448
- const cfConnectingIP = req.headers['cf-connecting-ip'];
1449
-
1450
- let realIP = req.ip;
1451
-
1452
- if (xForwardedFor) {
1453
- realIP = xForwardedFor.split(',')[0].trim();
1454
- } else if (xRealIP) {
1455
- realIP = xRealIP;
1456
- } else if (cfConnectingIP) {
1457
- realIP = cfConnectingIP;
1458
- }
1459
-
1460
- req.realIP = realIP;
1461
-
1462
- console.log(`🔍 Captured IPs:`, { xForwardedFor, xRealIP, cfConnectingIP, realIP });
1463
-
1464
- const keyDoc = await db.findOne({ key: apiKey });
1465
-
1466
- if (!keyDoc) {
1467
- return res.status(403).json({ error: "Invalid API Key." });
1468
- }
1469
-
1470
  const url = req.query.url;
1471
  if (!url) {
1472
  return res.status(400).json({ error: "url parameter is required." });
1473
  }
1474
-
1475
  const results = await facebookdl(url);
1476
 
1477
  for (const video of results.video) {
@@ -1480,12 +927,6 @@ AllDlRoutes.get('/api/v1/dl/fb', authenticateApiKey, apiLimiter, async (req, res
1480
  for (const audio of results.audio) {
1481
  audio.url = await audio.download();
1482
  }
1483
- await updateIP(apiKey, realIP);
1484
- await TelegramUseLog(
1485
- keyDoc.owner,
1486
- keyDoc.key,
1487
- `Accessed: ${req.path}\nRealIP: ${realIP}\nUser-Agent: ${userAgent}`
1488
- );
1489
  res.json({ results });
1490
  } catch (error) {
1491
  res.status(500).json({ error: error.message });
@@ -1524,44 +965,10 @@ AllDlRoutes.get('/api/v1/dl/fb', authenticateApiKey, apiLimiter, async (req, res
1524
  */
1525
  AllDlRoutes.get('/api/v1/dl/snapsave', authenticateApiKey, apiLimiter, async (req, res) => {
1526
  try {
1527
- const apiKey = req.headers['x-api-key'];
1528
- const userAgent = req.headers['user-agent'];
1529
-
1530
- const xForwardedFor = req.headers['x-forwarded-for'];
1531
- const xRealIP = req.headers['x-real-ip'];
1532
- const cfConnectingIP = req.headers['cf-connecting-ip'];
1533
-
1534
- let realIP = req.ip;
1535
-
1536
- if (xForwardedFor) {
1537
- realIP = xForwardedFor.split(',')[0].trim();
1538
- } else if (xRealIP) {
1539
- realIP = xRealIP;
1540
- } else if (cfConnectingIP) {
1541
- realIP = cfConnectingIP;
1542
- }
1543
-
1544
- req.realIP = realIP;
1545
-
1546
- console.log(`🔍 Captured IPs:`, { xForwardedFor, xRealIP, cfConnectingIP, realIP });
1547
-
1548
- const keyDoc = await db.findOne({ key: apiKey });
1549
-
1550
- if (!keyDoc) {
1551
- return res.status(403).json({ error: "Invalid API Key." });
1552
- }
1553
-
1554
  const url = req.query.url;
1555
-
1556
  if (!url) {
1557
  return res.status(400).json({ error: "url parameter is required." });
1558
  }
1559
- await updateIP(apiKey, realIP);
1560
- await TelegramUseLog(
1561
- keyDoc.owner,
1562
- keyDoc.key,
1563
- `Accessed: ${req.path}\nRealIP: ${realIP}\nUser-Agent: ${userAgent}`
1564
- );
1565
  const results = await snapsave(url);
1566
  res.json({ results });
1567
  } catch (error) {
@@ -1601,43 +1008,10 @@ AllDlRoutes.get('/api/v1/dl/snapsave', authenticateApiKey, apiLimiter, async (re
1601
  */
1602
  AllDlRoutes.get('/api/v1/dl/savefrom', authenticateApiKey, apiLimiter, async (req, res) => {
1603
  try {
1604
- const apiKey = req.headers['x-api-key'];
1605
- const userAgent = req.headers['user-agent'];
1606
-
1607
- const xForwardedFor = req.headers['x-forwarded-for'];
1608
- const xRealIP = req.headers['x-real-ip'];
1609
- const cfConnectingIP = req.headers['cf-connecting-ip'];
1610
-
1611
- let realIP = req.ip;
1612
-
1613
- if (xForwardedFor) {
1614
- realIP = xForwardedFor.split(',')[0].trim();
1615
- } else if (xRealIP) {
1616
- realIP = xRealIP;
1617
- } else if (cfConnectingIP) {
1618
- realIP = cfConnectingIP;
1619
- }
1620
-
1621
- req.realIP = realIP;
1622
-
1623
- console.log(`🔍 Captured IPs:`, { xForwardedFor, xRealIP, cfConnectingIP, realIP });
1624
-
1625
- const keyDoc = await db.findOne({ key: apiKey });
1626
-
1627
- if (!keyDoc) {
1628
- return res.status(403).json({ error: "Invalid API Key." });
1629
- }
1630
  const url = req.query.url;
1631
-
1632
  if (!url) {
1633
  return res.status(400).json({ error: "url parameter is required." });
1634
  }
1635
- await updateIP(apiKey, realIP);
1636
- await TelegramUseLog(
1637
- keyDoc.owner,
1638
- keyDoc.key,
1639
- `Accessed: ${req.path}\nRealIP: ${realIP}\nUser-Agent: ${userAgent}`
1640
- );
1641
  const results = await savefrom(url);
1642
  res.json({ results });
1643
  } catch (error) {
@@ -1677,43 +1051,10 @@ AllDlRoutes.get('/api/v1/dl/savefrom', authenticateApiKey, apiLimiter, async (re
1677
  */
1678
  AllDlRoutes.get('/api/v1/dl/xnxx', authenticateApiKey, apiLimiter, async (req, res) => {
1679
  try {
1680
- const apiKey = req.headers['x-api-key'];
1681
- const userAgent = req.headers['user-agent'];
1682
-
1683
- const xForwardedFor = req.headers['x-forwarded-for'];
1684
- const xRealIP = req.headers['x-real-ip'];
1685
- const cfConnectingIP = req.headers['cf-connecting-ip'];
1686
-
1687
- let realIP = req.ip;
1688
-
1689
- if (xForwardedFor) {
1690
- realIP = xForwardedFor.split(',')[0].trim();
1691
- } else if (xRealIP) {
1692
- realIP = xRealIP;
1693
- } else if (cfConnectingIP) {
1694
- realIP = cfConnectingIP;
1695
- }
1696
-
1697
- req.realIP = realIP;
1698
-
1699
- console.log(`🔍 Captured IPs:`, { xForwardedFor, xRealIP, cfConnectingIP, realIP });
1700
-
1701
- const keyDoc = await db.findOne({ key: apiKey });
1702
-
1703
- if (!keyDoc) {
1704
- return res.status(403).json({ error: "Invalid API Key." });
1705
- }
1706
  const q = req.query.q;
1707
-
1708
  if (!q) {
1709
  return res.status(400).json({ error: "q parameter is required." });
1710
  }
1711
- await updateIP(apiKey, realIP);
1712
- await TelegramUseLog(
1713
- keyDoc.owner,
1714
- keyDoc.key,
1715
- `Accessed: ${req.path}\nRealIP: ${realIP}\nUser-Agent: ${userAgent}`
1716
- );
1717
  const results = await XnxxDownloader(q);
1718
  res.json({ results });
1719
  } catch (error) {
 
40
  );
41
  }
42
 
 
43
  async function downloadMedia(media) {
44
  const downloadResults = {};
45
  try {
 
91
  */
92
  AllDlRoutes.get('/api/v1/dl/terabox-v4', async (req, res) => {
93
  try {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  const q = req.query.url;
 
 
 
 
 
 
95
  const results = await TeraboxV4Downloader(q);
96
  res.json({ message: results });
97
  } catch (error) {
 
131
  */
132
  AllDlRoutes.get('/api/v1/dl/twitter-v3', async (req, res) => {
133
  try {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  const q = req.query.url;
 
 
 
 
 
 
135
  const results = await TwitterDownloderV3(q);
136
  res.json({ message: results });
137
  } catch (error) {
 
171
  */
172
  AllDlRoutes.get('/api/v1/dl/twitter-v2', async (req, res) => {
173
  try {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  const q = req.query.url;
 
 
 
 
 
 
175
  const results = await TwitterDownloaderV2(q);
176
  res.json({ message: results });
177
  } catch (error) {
 
211
  */
212
  AllDlRoutes.get('/api/v1/dl/xnxx-info-v2', authenticateApiKey, apiLimiter, async (req, res) => {
213
  try {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
214
  const q = req.query.url;
 
215
  if (!q) {
216
  return res.status(400).json({ error: "url parameter is required." });
217
  }
 
 
 
 
 
 
218
  const results = await XInfoDownloaderV2(q);
219
  res.json({ message: results });
220
  } catch (error) {
 
254
  */
255
  AllDlRoutes.get('/api/v1/dl/xnxx-search-v2', authenticateApiKey, apiLimiter, async (req, res) => {
256
  try {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
257
  const q = req.query.q;
258
  if (!q) {
259
  return res.status(400).json({ error: "q parameter is required." });
260
  }
 
 
 
 
 
 
261
  const results = await XsearchDownloaderV2(q);
262
  res.json({ message: results });
263
  // console.dir(testings);
 
298
  */
299
  AllDlRoutes.get('/api/v1/dl/instagram-v4', authenticateApiKey, apiLimiter, async (req, res) => {
300
  try {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
301
  const q = req.query.url;
 
302
  if (!q) {
303
  return res.status(400).json({ error: "URL parameter is required." });
304
  }
 
 
 
 
 
 
305
  const results = await InstagramDLV4(q);
306
  res.json({ results });
307
  } catch (error) {
 
342
  */
343
  AllDlRoutes.get('/api/v1/dl/instagram-v3', authenticateApiKey, apiLimiter, async (req, res) => {
344
  try {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
345
  const q = req.query.url;
346
  if (!q) {
347
  return res.status(400).json({ error: "URL parameter is required." });
348
  }
 
 
 
 
 
 
349
  const results = await InstagramDLV3(q);
350
  res.json({ results });
351
  } catch (error) {
 
385
  */
386
  AllDlRoutes.get('/api/v1/dl/instagram-v2', authenticateApiKey, apiLimiter, async (req, res) => {
387
  try {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
388
  const q = req.query.url;
 
389
  if (!q) {
390
  return res.status(400).json({ error: "URL parameter is required." });
391
  }
 
 
 
 
 
 
392
  const results = await InstagramDLV2(q);
393
  res.json({ results });
394
  } catch (error) {
 
428
  */
429
  AllDlRoutes.get('/api/v1/dl/pint', authenticateApiKey, apiLimiter, async (req, res) => {
430
  try {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
431
  const q = req.query.q;
 
432
  if (!q) {
433
  return res.status(400).json({ error: "URL parameter is required." });
434
  }
 
 
 
 
 
 
435
  const results = await PinterestDL(q);
436
  res.json({ results });
437
  } catch (error) {
 
472
  */
473
  AllDlRoutes.get('/api/v1/dl/sfilemobi-search', authenticateApiKey, apiLimiter, async (req, res) => {
474
  try {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
475
  const q = req.query.q;
 
476
  if (!q) {
477
  return res.status(400).json({ error: "URL parameter is required." });
478
  }
 
 
 
 
 
 
479
  const results = await sfilemobiSearch(q);
480
  res.json({ results });
481
  } catch (error) {
 
653
  */
654
  AllDlRoutes.get('/api/v1/dl/capcut', authenticateApiKey, apiLimiter, async (req, res) => {
655
  try {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
656
  const url = req.query.url;
 
657
  if (!url) {
658
  return res.status(400).json({ error: "URL parameter is required." });
659
  }
 
 
 
 
 
 
660
  const results = capcutdl(url);
661
  res.json({ results });
662
  } catch (error) {
 
697
  */
698
  AllDlRoutes.get('/api/v1/dl/instagram', authenticateApiKey, apiLimiter, async (req, res) => {
699
  try {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
700
  const url = req.query.url;
 
701
  if (!url) {
702
  return res.status(400).json({ error: "URL parameter is required." });
703
  }
 
 
 
 
 
 
704
  const results = await InstagramDownloader(url);
705
  res.json({ results });
706
  } catch (error) {
 
740
  */
741
  AllDlRoutes.get('/api/v1/dl/twitter', authenticateApiKey, apiLimiter, async (req, res) => {
742
  try {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
743
  const url = req.query.url;
744
 
745
  if (!url) {
746
  return res.status(400).json({ error: "URL parameter is required." });
747
  }
 
 
 
 
 
 
748
  const results = await TwitterDownloader(url);
749
  res.json({ results });
750
  } catch (error) {
 
784
  */
785
  AllDlRoutes.get('/api/v1/dl/sfilemobi', authenticateApiKey, apiLimiter, async (req, res) => {
786
  try {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
787
  const url = req.query.url;
 
788
  if (!url) {
789
  return res.status(400).json({ error: "URL parameter is required." });
790
  }
 
 
 
 
 
 
791
  const results = await sfilemobi(url);
792
  res.json({ results });
793
  } catch (error) {
 
827
  */
828
  AllDlRoutes.get('/api/v1/dl/tiktok', authenticateApiKey, apiLimiter, async (req, res) => {
829
  try {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
830
  const url = req.query.url;
 
831
  if (!url) {
832
  return res.status(400).json({ error: "URL parameter is required." });
833
  }
 
 
 
 
 
 
834
  const results = await TiktokDownloader(url);
835
  res.json({ results });
836
  } catch (error) {
 
870
  */
871
  AllDlRoutes.get('/api/v1/dl/tiktok-v2', authenticateApiKey, apiLimiter, async (req, res) => {
872
  try {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
873
  const url = req.query.url;
874
  if (!url) {
875
  return res.status(400).json({ error: "URL parameter is required." });
876
  }
 
 
 
 
 
 
 
 
877
  const results = await tiktokdl(url);
878
  res.json({ results });
879
 
 
915
  */
916
  AllDlRoutes.get('/api/v1/dl/fb', authenticateApiKey, apiLimiter, async (req, res) => {
917
  try {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
918
  const url = req.query.url;
919
  if (!url) {
920
  return res.status(400).json({ error: "url parameter is required." });
921
  }
 
922
  const results = await facebookdl(url);
923
 
924
  for (const video of results.video) {
 
927
  for (const audio of results.audio) {
928
  audio.url = await audio.download();
929
  }
 
 
 
 
 
 
930
  res.json({ results });
931
  } catch (error) {
932
  res.status(500).json({ error: error.message });
 
965
  */
966
  AllDlRoutes.get('/api/v1/dl/snapsave', authenticateApiKey, apiLimiter, async (req, res) => {
967
  try {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
968
  const url = req.query.url;
 
969
  if (!url) {
970
  return res.status(400).json({ error: "url parameter is required." });
971
  }
 
 
 
 
 
 
972
  const results = await snapsave(url);
973
  res.json({ results });
974
  } catch (error) {
 
1008
  */
1009
  AllDlRoutes.get('/api/v1/dl/savefrom', authenticateApiKey, apiLimiter, async (req, res) => {
1010
  try {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1011
  const url = req.query.url;
 
1012
  if (!url) {
1013
  return res.status(400).json({ error: "url parameter is required." });
1014
  }
 
 
 
 
 
 
1015
  const results = await savefrom(url);
1016
  res.json({ results });
1017
  } catch (error) {
 
1051
  */
1052
  AllDlRoutes.get('/api/v1/dl/xnxx', authenticateApiKey, apiLimiter, async (req, res) => {
1053
  try {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1054
  const q = req.query.q;
 
1055
  if (!q) {
1056
  return res.status(400).json({ error: "q parameter is required." });
1057
  }
 
 
 
 
 
 
1058
  const results = await XnxxDownloader(q);
1059
  res.json({ results });
1060
  } catch (error) {