Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Pemilu 2019
- # Author: 4WSec
- # Date: 18/04/2019
- # Color
- GR='\033[92m' # green
- RD='\033[91m' # red
- NT='\033[97m' # netral
- clear
- function get_data () {
- local go=$(curl -s "https://kpu.nyandev.id/api/v1/count" -o result.tmp)
- if [[ $go =~ 'Cannot GET' ]]; then
- printf "${NT}[${RD}!${RD}] ${RD}Error, Try Again ...\n"
- rm -f result.tmp
- exit 0
- else
- local jokowi=$(cat result.tmp | jq '.results | .jokowi | .percent' -r)
- local prabowo=$(cat result.tmp | jq '.results | .prabowo | .percent' -r)
- local totalowi=$(cat result.tmp | jq '.results | .jokowi | .total' -r)
- local totalowo=$(cat result.tmp | jq '.results | .prabowo | .total' -r)
- local total=$(cat result.tmp | jq '.results | .progress | .total' -r)
- local proses=$(cat result.tmp | jq '.results | .progress | .proses' -r)
- echo
- printf "${NT}( PEMILU 2019 )\n"
- echo
- printf "${NT}.................\n"
- printf "${GR}Jokowi : ${RD}$jokowi\n"
- printf "${GR}Total : ${RD}$totalowi\n"
- printf "${NT}.................\n"
- printf "${GR}Prabowo : ${RD}$prabowo\n"
- printf "${GR}Total : ${RD}$totalowo\n"
- printf "${NT}.................\n"
- echo
- printf "${NT}... Progress ...\n"
- printf "${GR}Total : ${RD}$total\n"
- printf "${GR}Proses : ${RD}$proses\n"
- fi
- }
- get_data
- rm -f result.tmp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement