Advertisement
IbnuSyawall

swdL

May 21st, 2020
1,288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.   - name: status whatsapp saver
  3.   - require: node [glob, cli-table, shelljs, readline, colors]
  4.   - install: wget https://pastebin.com/raw/jTL3MRjQ -O swdL.js
  5. */
  6.  
  7. const glob = require('glob')
  8. const table1   = require("cli-table")
  9. const shelljs  = require('shelljs')
  10. const readline = require('readline')
  11. const fs = require('fs')
  12. require('colors')
  13.  
  14. const _tableFile = new table1({
  15.   head: ['no', 'modified', 'name', 'type'],
  16.   colWidths: [5, 17, 40, 8]
  17. })
  18.  
  19. const ask = readline.createInterface({
  20.   input : process.stdin,
  21.   output: process.stdout
  22. })
  23.  
  24. if (!fs.existsSync('/sdcard/unduh-sw')) {
  25.   shelljs.mkdir('/sdcard/unduh-sw')
  26.   return
  27. }
  28.  
  29. const __dir = '/sdcard/WhatsApp/Media/.Statuses/'
  30.  
  31. console.log('\n       [      STATUS WHATSAPP SAVER (swdL)  by Ibnusyawall     ]')
  32. console.log('                         Black Coder Crush')
  33.  
  34. glob('/sdcard/WhatsApp/Media/.Statuses/*.*', (err, files) => {
  35.   const _cmp4 = [... files].toString().match(/(mp4)/gi).length
  36.   const _cjpg = [... files].toString().match(/(jpg)/gi).length
  37.   console.log('\n total: ', files.length, 'Files', `( mp4: ${_cmp4} | jpg: ${_cjpg} )`)
  38.   const f = new Array({... files})
  39.   console.log(_tableFile.toString())
  40.   files.forEach((val, key) => {
  41.     const stats = fs.statSync(val)
  42.     const mstat = stats.ctime.toString()
  43.     const mstm0 = mstat
  44.     const mstm1 = mstat.split(' ')[1] + '/' + mstat.split(' ')[3] + ' ' + mstat.slice(15, 21)
  45.     const no = key+1
  46.     const nf = val.replace(__dir, '').cyan
  47.     const nt = val.replace(__dir, '').slice(33).brightWhite
  48.     const bb = no.toString().length == 1 ? `0${no}`.underline.brightWhite : `${no}`.underline.brightWhite
  49.     console.log('%s', `  ${bb}    ${mstm1}    ${nf}     ${nt}`)
  50.   })
  51.  
  52.   ask.question('\n [?] Download [jpg/mp4] : ', (yn) => {
  53.     if (yn != '') {
  54.       switch (yn) {
  55.         case 'jpg':
  56.           glob(`${__dir}*.jpg`, (err, files) => {
  57.             if (err) throw err
  58.             shelljs.cp('-f', [... files], '/sdcard/unduh-sw')
  59.             console.log(`\n [+] OK: ${_cjpg} File telah didownload.\n [+] To: /sdcard/unduh-sw\n`); process.exit()
  60.             return
  61.           })
  62.           break;
  63.         case 'mp4':
  64.           glob(`${__dir}*.mp4`, (err, files) => {
  65.             if (err) throw err
  66.             shelljs.cp('-f', [... files], '/sdcard/unduh-sw')
  67.             console.log(`\n [+] OK: ${_cmp4} File telah didownload.\n [+] To: /sdcard/unduh-sw\n`); process.exit()
  68.             return
  69.           })
  70.           break;
  71.       }
  72.     } else {
  73.         console.log('\n [!] Masukan pilihan! (exited)'); process.exit()
  74.     }
  75.   })
  76. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement