ilhamdev commited on
Commit
0940a53
·
verified ·
1 Parent(s): 0879cd7

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +82 -50
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
- const host = 'https://' + req.get('host');
392
- res.json({
393
- "List": [
394
- {
395
- "title": "Tiktok Downloader",
396
- "method": "GET",
397
- "example": `${host}/tt?url=`
398
- },
399
- {
400
- "title": "Facebook Downloader",
401
- "method": "GET",
402
- "example": `${host}/fb?url=`
403
- },
404
- {
405
- "title": "Instagram Downloader",
406
- "method": "GET",
407
- "example": `${host}/ig?url=`
408
- },
409
- {
410
- "title": "Youtube Downloader",
411
- "method": "GET",
412
- "example": `${host}/ytdl?url=`
413
- },
414
- {
415
- "title": "Youtube Search",
416
- "method": "GET",
417
- "example": `${host}/ytsearch?q=`
418
- },
419
- {
420
- "title": "Pinterest Downloader",
421
- "method": "GET",
422
- "example": `${host}/pindl?url=`
423
- },
424
- {
425
- "title": "Mediafire Downloader",
426
- "method": "GET",
427
- "example": `${host}/mediafire?url=`
428
- },
429
- {
430
- "title": "Mega Downloader",
431
- "method": "GET",
432
- "example": `${host}/mega?url=`+ '${encodeURIComponent(${url})}',
433
- },
434
- {
435
- "title": "Twitter/X Downloader",
436
- "method": "GET",
437
- "example": `${host}/twitter?url=`,
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 {