Update index.js
Browse files
index.js
CHANGED
|
@@ -6,6 +6,8 @@ const { Writable, pipeline } = require('stream');
|
|
| 6 |
const util = require('util');
|
| 7 |
const axios = require('axios');
|
| 8 |
const FormData = require('form-data')
|
|
|
|
|
|
|
| 9 |
const cheerio = require('cheerio')
|
| 10 |
const cloudscraper = require('cloudscraper')
|
| 11 |
const { File } = require('megajs')
|
|
@@ -387,58 +389,88 @@ app.set('json spaces', 4);
|
|
| 387 |
app.use(morgan('dev'));
|
| 388 |
app.use(express.json());
|
| 389 |
|
|
|
|
|
|
|
| 390 |
app.all('/', (req, res) => {
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
|
| 400 |
-
|
| 401 |
-
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
|
| 434 |
-
|
| 435 |
-
|
| 436 |
-
|
| 437 |
-
|
| 438 |
-
|
| 439 |
-
|
| 440 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 441 |
});
|
|
|
|
| 442 |
app.get('/yt', async (req, res) => {
|
| 443 |
const host = 'https://' + req.get('host');
|
| 444 |
try {
|
|
|
|
| 6 |
const util = require('util');
|
| 7 |
const axios = require('axios');
|
| 8 |
const FormData = require('form-data')
|
| 9 |
+
const cp = require('child_process')
|
| 10 |
+
const os = require('os')
|
| 11 |
const cheerio = require('cheerio')
|
| 12 |
const cloudscraper = require('cloudscraper')
|
| 13 |
const { File } = require('megajs')
|
|
|
|
| 389 |
app.use(morgan('dev'));
|
| 390 |
app.use(express.json());
|
| 391 |
|
| 392 |
+
const v8 = require('v8');
|
| 393 |
+
|
| 394 |
app.all('/', (req, res) => {
|
| 395 |
+
const status = {}
|
| 396 |
+
status['diskUsage'] = cp.execSync('du -sh').toString().split('M')[0] + ' MB'
|
| 397 |
+
|
| 398 |
+
const used = process.memoryUsage()
|
| 399 |
+
for (let x in used) status[x] = formatSize(used[x])
|
| 400 |
+
|
| 401 |
+
const totalmem = os.totalmem()
|
| 402 |
+
const freemem = os.freemem()
|
| 403 |
+
status['memoryUsage'] = `${formatSize(totalmem - freemem)} / ${formatSize(totalmem)}`
|
| 404 |
+
|
| 405 |
+
// Menambahkan statistik heap V8
|
| 406 |
+
const heapStats = v8.getHeapStatistics();
|
| 407 |
+
for (let x in heapStats) status[x] = formatSize(heapStats[x])
|
| 408 |
+
|
| 409 |
+
// Menambahkan semua properti dan metode dari v8
|
| 410 |
+
for (let x in v8) {
|
| 411 |
+
if (typeof v8[x] === 'function') {
|
| 412 |
+
status[x] = 'function'
|
| 413 |
+
} else {
|
| 414 |
+
status[x] = v8[x]
|
| 415 |
+
}
|
| 416 |
+
}
|
| 417 |
+
|
| 418 |
+
const host = 'https://' + req.get('host');
|
| 419 |
+
res.json({
|
| 420 |
+
creator: `@${process.env['SPACE_AUTHOR_NAME'] || 'ALOK FF'}`,
|
| 421 |
+
message: 'Hello World!',
|
| 422 |
+
uptime: new Date(process.uptime() * 1000).toUTCString().split(' ')[4],
|
| 423 |
+
status,
|
| 424 |
+
"List": [
|
| 425 |
+
{
|
| 426 |
+
"title": "Tiktok Downloader",
|
| 427 |
+
"method": "GET",
|
| 428 |
+
"example": `${host}/tt?url=`
|
| 429 |
+
},
|
| 430 |
+
{
|
| 431 |
+
"title": "Facebook Downloader",
|
| 432 |
+
"method": "GET",
|
| 433 |
+
"example": `${host}/fb?url=`
|
| 434 |
+
},
|
| 435 |
+
{
|
| 436 |
+
"title": "Instagram Downloader",
|
| 437 |
+
"method": "GET",
|
| 438 |
+
"example": `${host}/ig?url=`
|
| 439 |
+
},
|
| 440 |
+
{
|
| 441 |
+
"title": "Youtube Downloader",
|
| 442 |
+
"method": "GET",
|
| 443 |
+
"example": `${host}/ytdl?url=`
|
| 444 |
+
},
|
| 445 |
+
{
|
| 446 |
+
"title": "Youtube Search",
|
| 447 |
+
"method": "GET",
|
| 448 |
+
"example": `${host}/ytsearch?q=`
|
| 449 |
+
},
|
| 450 |
+
{
|
| 451 |
+
"title": "Pinterest Downloader",
|
| 452 |
+
"method": "GET",
|
| 453 |
+
"example": `${host}/pindl?url=`
|
| 454 |
+
},
|
| 455 |
+
{
|
| 456 |
+
"title": "Mediafire Downloader",
|
| 457 |
+
"method": "GET",
|
| 458 |
+
"example": `${host}/mediafire?url=`
|
| 459 |
+
},
|
| 460 |
+
{
|
| 461 |
+
"title": "Mega Downloader",
|
| 462 |
+
"method": "GET",
|
| 463 |
+
"example": `${host}/mega?url=`+ `${encodeURIComponent("url")}`,
|
| 464 |
+
},
|
| 465 |
+
{
|
| 466 |
+
"title": "Twitter/X Downloader",
|
| 467 |
+
"method": "GET",
|
| 468 |
+
"example": `${host}/twitter?url=`,
|
| 469 |
+
}
|
| 470 |
+
]
|
| 471 |
+
});
|
| 472 |
});
|
| 473 |
+
|
| 474 |
app.get('/yt', async (req, res) => {
|
| 475 |
const host = 'https://' + req.get('host');
|
| 476 |
try {
|