[download]

local/bin/grabmenu

   1 #!/bin/bash
   2 
   3 audio(){ # {{{
   4     term "youtube-dl -io ~/'%(title)s.%(ext)s' \
   5     --extract-audio --audio-quality 0 --audio-format mp3 \
   6     --add-metadata --embed-thumbnail --console-title $@"
   7 } # }}}
   8 invidious(){ # {{{
   9     chromium "${@//www\.youtube\.com/redirect.invidious.io}" &
  10 } # }}}
  11 mpv-audio(){ # {{{
  12     mpv --profile=audio "$@" &
  13 } # }}}
  14 
  15 dragon -T -t -x |
  16 while read url; do case $url in
  17     *4chan*|*4cdn*|*2ch*)
  18         file=~/Пепесы/${url##*/}
  19         wget -cO  "$file" "$url" &&
  20         notify-send -i "$file" "file://$file" &
  21     ;;
  22 
  23     *fan.tv*)
  24         mpv $(curl -s "$url" | grep -ao 'https:.*\.mp4') &
  25     ;;
  26 
  27     *)
  28         while read exec; do
  29             [[
  30                 $exec == wget  ||
  31                 $exec == youtube-dl
  32             ]] && exec="term $exec"
  33 
  34             $exec "$url" &
  35         done < <(
  36             printf '%s\n' mpv mpv-audio audio nemo gvim wget \
  37             youtube-dl chromium luakit invidious | sort |
  38             menu -i grab
  39         )
  40     ;;
  41 esac done