Advertisement
ZucoCheezy

Pemilu 2019

Apr 18th, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.30 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Pemilu 2019
  4. # Author: 4WSec
  5. # Date: 18/04/2019
  6.  
  7. # Color
  8. GR='\033[92m' # green
  9. RD='\033[91m' # red
  10. NT='\033[97m' # netral
  11.  
  12. clear
  13.  
  14. function get_data () {
  15.     local go=$(curl -s "https://kpu.nyandev.id/api/v1/count" -o result.tmp)
  16.     if [[ $go =~ 'Cannot GET' ]]; then
  17.         printf "${NT}[${RD}!${RD}] ${RD}Error, Try Again ...\n"
  18.         rm -f result.tmp
  19.         exit 0
  20.     else
  21.         local jokowi=$(cat result.tmp | jq '.results | .jokowi | .percent' -r)
  22.         local prabowo=$(cat result.tmp | jq '.results | .prabowo | .percent' -r)
  23.         local totalowi=$(cat result.tmp | jq '.results | .jokowi | .total' -r)
  24.         local totalowo=$(cat result.tmp | jq '.results | .prabowo | .total' -r)
  25.         local total=$(cat result.tmp | jq '.results | .progress | .total' -r)
  26.         local proses=$(cat result.tmp | jq '.results | .progress | .proses' -r)
  27.         echo
  28.         printf "${NT}( PEMILU 2019 )\n"
  29.         echo
  30.         printf "${NT}.................\n"
  31.         printf "${GR}Jokowi  : ${RD}$jokowi\n"
  32.         printf "${GR}Total   : ${RD}$totalowi\n"
  33.         printf "${NT}.................\n"
  34.         printf "${GR}Prabowo : ${RD}$prabowo\n"
  35.         printf "${GR}Total   : ${RD}$totalowo\n"
  36.         printf "${NT}.................\n"
  37.         echo
  38.         printf "${NT}... Progress ...\n"
  39.         printf "${GR}Total   : ${RD}$total\n"
  40.         printf "${GR}Proses  : ${RD}$proses\n"
  41.     fi
  42. }
  43.  
  44. get_data
  45. rm -f result.tmp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement