update_yt-dlp.sh 501 B

12345678910111213141516171819202122
  1. #!/bin/bash
  2. # fail if any commands fails
  3. set -e
  4. # debug log
  5. #set -x
  6. # Set superuser privileges command if not set
  7. if [[ -z $su ]]; then
  8. export su="sudo"
  9. fi
  10. $su apt-get update -qq
  11. $su apt-get install -qq -y curl
  12. cd || return
  13. mkdir -p ~/Applications
  14. cd ~/Applications || return
  15. curl -O -L "$(curl -s https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest | jq -r ".assets[] | select(.name | test(\"yt-dlp_linux\")) | .browser_download_url" | head -n 1)"
  16. chmod +x ./yt-dlp_linux
  17. cd - || return