backup before delete youtubedl script
markdown ``` #!/bin/bash tty -s; if [ $? -ne 0 ]; then xfce4-terminal -e "\"$0\""; exit; fi if [ $UID -ne 0 ]; then echo "restart as root"; sudo "$0"; exit; fi cd /home/jax/Videos/ while((1)) do # Get link echo "Please enter link:" read link id=${link#*=} best=$(youtube-dl --list-formats --proxy socks5://127.0.0.1:1080 $link | grep best) best=($best) # Try download #youtube-dl --proxy socks5://127.0.0.1:1080 -f ${best[0]} $link output=$(youtube-dl --proxy socks5://127.0.0.1:1080 -f ${best[0]} $link 2>&1) # If name too long, changing name to "$id.mp4" if [[ $? == 1 ]];then name=${output#*"'"} name=${name%.*} #echo $name #echo $id echo "File name too long." echo "$id -> $name" >> ./filename.txt youtube-dl --proxy socks5://127.0.0.1:1080 --id -f ${best[0]} $link fi ...