metalx1000

BASH Menu List with Whiptail to Download Videos from URL

Nov 12th, 2017
690
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.57 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. TITLE="Select One"
  4. MENU="Make a Choice"
  5. url="http://www.aniprop.com/wp-content/uploads/2017/04/"
  6. mapfile -t urls < <(lynx --dump "$url" |grep "Death-Note"|grep " http"|awk '{print $2}')
  7.  
  8.  
  9. function getList(){
  10. #  printf "%s\n" "${urls[@]}"|while read line
  11. #  do
  12. #    echo "\"$(basename "$line")\" \"-\""
  13. #  done
  14.   for (( i=0; i<${#urls[@]}; i++ ));
  15.   do
  16.     echo "$i \"$(basename ${urls[i]})\"";
  17.   done
  18. }
  19.  
  20. s="$(whiptail --title "$TITLE" --menu "MENU" 16 100 9 $(getList)  3>&2 2>&1 1>&3)"
  21.  
  22. echo "${urls[s]}"
  23. #wget "${urls[s]}"
  24. mpv "${urls[s]}"
Add Comment
Please, Sign In to add comment