metalx1000

dl downloader

Jan 30th, 2022
676
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.58 KB | None | 0 0
  1. #!/bin/bash
  2. ######################################################################
  3. #Copyright (C) 2022  Kris Occhipinti
  4. #https://filmsbykris.com
  5.  
  6. #downloads url from clipboard
  7.  
  8. #This program is free software: you can redistribute it and/or modify
  9. #it under the terms of the GNU General Public License as published by
  10. #the Free Software Foundation, either version 3 of the License, or
  11. #(at your option) any later version.
  12.  
  13. #This program is distributed in the hope that it will be useful,
  14. #but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. #GNU General Public License for more details.
  17.  
  18. #You should have received a copy of the GNU General Public License
  19. #along with this program.  If not, see <http://www.gnu.org/licenses/>.
  20. ######################################################################
  21.  
  22. [[ "$1" == "" ]] && url="$(xclip -o)" || url="$1"
  23. file="$(basename "$url")"
  24.  
  25. function rename(){
  26.   name="$(echo -e "$file\nRENAME"|fzf --prompt "Save file as $file or rename it? ")"
  27.   [[ "$name" == "RENAME" ]] && read -p "Save As: " file
  28.   echo "Downloading $url to $file"
  29. }
  30. if [[ "$url" == *"youtu"* ]] || [[ "$url" == *"m3u"* ]];then
  31.   echo ": $(date +%s):0;youtube-dl '$url'" >> $HOME/.zsh_history
  32.   youtube-dl "$url"
  33. elif [[ "$url" == *"torrent"* ]] || [[ "$url" == *"magnet"* ]];then
  34.   rename
  35.   echo ": $(date +%s):0;aria2c '$url'" >> $HOME/.zsh_history
  36.   aria2c "$url"
  37. else
  38.   rename
  39.   echo ": $(date +%s):0;axel -n 10 '$url' -o '$file'" >> $HOME/.zsh_history
  40.   axel -n 10 "$url" -o "$file"
  41. fi
  42.  
Add Comment
Please, Sign In to add comment