Update index.js
Browse files
index.js
CHANGED
|
@@ -329,40 +329,46 @@ const app = express()
|
|
| 329 |
{
|
| 330 |
"title": "Tiktok Downloader",
|
| 331 |
"method": "GET",
|
| 332 |
-
"example":
|
| 333 |
},
|
| 334 |
{
|
| 335 |
"title": "Facebook Downloader",
|
| 336 |
"method": "GET",
|
| 337 |
-
"example":
|
| 338 |
},
|
| 339 |
{
|
| 340 |
"title": "Instagram Downloader",
|
| 341 |
"method": "GET",
|
| 342 |
-
"example":
|
| 343 |
},
|
| 344 |
{
|
| 345 |
"title": "Youtube Downloader",
|
| 346 |
"method": "GET",
|
| 347 |
-
"example":
|
| 348 |
},
|
| 349 |
{
|
| 350 |
"title": "Youtube Search",
|
| 351 |
"method": "GET",
|
| 352 |
-
"example":
|
| 353 |
},
|
| 354 |
{
|
| 355 |
"title": "Pinterest Downloader",
|
| 356 |
"method": "GET",
|
| 357 |
-
"example":
|
| 358 |
},
|
| 359 |
{
|
| 360 |
"title": "Mediafire Downloader",
|
| 361 |
"method": "GET",
|
| 362 |
-
"example":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 363 |
}
|
| 364 |
]
|
| 365 |
-
})
|
| 366 |
.get('/yt', async (req, res) => {
|
| 367 |
const host = 'https://' + req.get('host');
|
| 368 |
try {
|
|
@@ -487,16 +493,17 @@ const app = express()
|
|
| 487 |
return res.json({ message: e.message });
|
| 488 |
}
|
| 489 |
})
|
| 490 |
-
.
|
| 491 |
try {
|
| 492 |
-
|
| 493 |
-
|
| 494 |
-
|
| 495 |
-
}
|
| 496 |
-
console.log(url)
|
| 497 |
-
} catch (e) {
|
| 498 |
-
console.log(e);
|
| 499 |
-
return res.json({ message: e.message });
|
| 500 |
}
|
| 501 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 502 |
.listen(7860, () => console.log('App running on port 7860'));
|
|
|
|
| 329 |
{
|
| 330 |
"title": "Tiktok Downloader",
|
| 331 |
"method": "GET",
|
| 332 |
+
"example": "${host}/tt?url="
|
| 333 |
},
|
| 334 |
{
|
| 335 |
"title": "Facebook Downloader",
|
| 336 |
"method": "GET",
|
| 337 |
+
"example": "${host}/fb?url="
|
| 338 |
},
|
| 339 |
{
|
| 340 |
"title": "Instagram Downloader",
|
| 341 |
"method": "GET",
|
| 342 |
+
"example": "${host}/ig?url="
|
| 343 |
},
|
| 344 |
{
|
| 345 |
"title": "Youtube Downloader",
|
| 346 |
"method": "GET",
|
| 347 |
+
"example": "${host}/ytdl?url="
|
| 348 |
},
|
| 349 |
{
|
| 350 |
"title": "Youtube Search",
|
| 351 |
"method": "GET",
|
| 352 |
+
"example": "${host}/ytsearch?q="
|
| 353 |
},
|
| 354 |
{
|
| 355 |
"title": "Pinterest Downloader",
|
| 356 |
"method": "GET",
|
| 357 |
+
"example": "${host}/pindl?url="
|
| 358 |
},
|
| 359 |
{
|
| 360 |
"title": "Mediafire Downloader",
|
| 361 |
"method": "GET",
|
| 362 |
+
"example": "${host}/mediafire?url="
|
| 363 |
+
},
|
| 364 |
+
{
|
| 365 |
+
"title": "Mega Downloader",
|
| 366 |
+
"method": "POST",
|
| 367 |
+
"example": "${host}/mega",
|
| 368 |
+
"body": "JSON.stringify({ \"url\": \"example.com\" })"
|
| 369 |
}
|
| 370 |
]
|
| 371 |
+
})
|
| 372 |
.get('/yt', async (req, res) => {
|
| 373 |
const host = 'https://' + req.get('host');
|
| 374 |
try {
|
|
|
|
| 493 |
return res.json({ message: e.message });
|
| 494 |
}
|
| 495 |
})
|
| 496 |
+
.post('/mega', async (req, res) => {
|
| 497 |
try {
|
| 498 |
+
let { url } = req.body;
|
| 499 |
+
if (!/https:\/\/mega\.nz\/file\/[a-zA-Z0-9]{8}#[a-zA-Z0-9-_]{43}/.test(url)) {
|
| 500 |
+
return res.json({ message: 'Invalid URL' });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 501 |
}
|
| 502 |
+
console.log(url);
|
| 503 |
+
return res.json({ message: 'URL is valid' });
|
| 504 |
+
} catch (e) {
|
| 505 |
+
console.log(e);
|
| 506 |
+
return res.json({ message: e.message });
|
| 507 |
+
}
|
| 508 |
+
});
|
| 509 |
.listen(7860, () => console.log('App running on port 7860'));
|