You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
2.6 KiB

  1. #!/usr/bin/env bash
  2. # ytdl-s - youtube-dl script
  3. # by HMsheets
  4. link=""
  5. IFS='' read -r -d '' titleVAR <<-'EOF'
  6. -----------------------------------------------
  7. . __ .___.__ .
  8. . ___.__._/ |_ __| _/| | ______ .
  9. . < | |\ __\/ __ | | | ______ / ___/ .
  10. . \___ | | | / /_/ | | |__ /_____/ \___ \ .
  11. . / ____| |__| \____ | |____/ /____ > .
  12. . \/ \/ \/ .
  13. -----------------------------------------------
  14. Version 0.5.0
  15. A bash script for interfacing with youtube-dl
  16. Written by HMSheets
  17. -------------------------------------------------
  18. EOF
  19. title() {
  20. echo "$titleVAR"
  21. }
  22. bestVideoPlusAudio() {
  23. # Best Video and Audio Quality Download
  24. clear
  25. title
  26. bvpaActive=1
  27. while [ $bvpaActive == 1 ]; do
  28. echo "Please provide a link"
  29. read usrlink
  30. link=$usrlink
  31. clear
  32. title
  33. echo "Do you want to also grab any English Subtitles? (y/n)"
  34. read subChoice
  35. clear
  36. title
  37. if [ $subChoice == y ]; then
  38. youtube-dl --write-srt --sub-lang en -f bestvideo+bestaudio $link
  39. elif [ $subChoice == n ]; then
  40. youtube-dl -f bestvideo+bestaudio $link
  41. else
  42. echo ""
  43. echo "ERROR: Selection Does Not Exist."
  44. sleep 1
  45. continue
  46. fi
  47. echo ""
  48. echo "Do you want to download another video? (y/n)"
  49. read anotherv
  50. if [ $anotherv == y ]; then
  51. continue
  52. elif [ $anotherv == n ]; then
  53. bvpaActive=0
  54. fi
  55. done
  56. }
  57. versionSelect() {
  58. clear
  59. title
  60. versionSelectActive=1
  61. while [ $versionSelectActive == 1 ]; do
  62. youtube-dl -F $link
  63. echo ""
  64. echo "Pick a version to Download"
  65. read version
  66. youtube-dl -f $version $link
  67. clear
  68. echo ""
  69. echo "Do you want to download another version? (y/n)"
  70. read anotherv
  71. if [ $anotherv == y ]; then
  72. continue
  73. elif [ $anotherv == n ]; then
  74. versionSelectActive=0
  75. fi
  76. done
  77. }
  78. while true; do
  79. clear
  80. title
  81. echo ""
  82. echo "Welcome to ytdl-s"
  83. echo ""
  84. echo "1 - Download Specific Versions of a Link"
  85. echo "2 - Download Video With Best Video+Best Audio"
  86. echo "3 - Exit"
  87. read choice1
  88. if [ $choice1 == 3 ]; then
  89. clear
  90. exit
  91. elif [[ $choice1 != 1 && $choice1 != 2 ]]; then
  92. echo ""
  93. echo "ERROR: Selection Does Not Exist. Restarting Script!"
  94. sleep 3
  95. continue
  96. fi
  97. if [ $choice1 == 1 ]; then
  98. echo "Please provide a link"
  99. read usrlink
  100. link=$usrlink
  101. versionSelect
  102. clear
  103. link=""
  104. elif [ $choice1 == 2 ]; then
  105. bestVideoPlusAudio
  106. clear
  107. link=""
  108. else
  109. echo ""
  110. echo"ERROR: Problem Reading Your Selection. Restarting Script!"
  111. sleep 3
  112. fi
  113. done