-LONER-

termux-url-opener

Nov 13th, 2021 (edited)
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.16 KB | None | 0 0
  1. ##!/data/data/com.termux/files/usr/bin/zsh
  2.  
  3. url=$1
  4. echo "Do what with $1 ?"
  5. echo "v) Download video file with yt-dlp"
  6. echo "m) Download music file with yt-dlp"
  7. echo "x) Download video and extract audio to file with yt-dlp"
  8. echo "w) Run wget"
  9. echo "c) Cancel operation"
  10. read CHOICE
  11.  
  12. case $CHOICE in
  13.     v)
  14.         yt-dlp -o "~/url-handler-temp/%(title)s.%(ext)s" --embed-chapters $url
  15.     sudo cp /data/data/com.termux/files/home/url-handler-temp/* /storage/????-????/Videos/
  16.     rm ~/url-handler-temp/*
  17.         ;;
  18.     m)
  19.         yt-dlp -o "~/url-handler-temp/%(title)s.%(ext)s" -f bestaudio[ext=m4a] $url
  20.     sudo cp /data/data/com.termux/files/home/url-handler-temp/* /storage/????-????/Music/
  21.     rm ~/url-handler-temp/*
  22.         ;;
  23.     x)
  24.         yt-dlp -o "~/url-handler-temp/%(title)s.%(ext)s" -x --audio-format m4a --audio-quality 256k $url
  25.     sudo cp /data/data/com.termux/files/home/url-handler-temp/* /storage/????-????/Music/
  26.     rm ~/url-handler-temp/*
  27.         ;;
  28.     w)
  29.         cd ~/storage/shared/Download
  30.         wget $url
  31.         cd ~
  32.         ;;
  33.     c)
  34.         echo "Cancelled"
  35.         ;;
  36. esac
  37.  
  38. read -r -p "Press return to exit" key
  39.  
  40. echo "Exiting..."
  41.  
Add Comment
Please, Sign In to add comment