Update youtube.sh

This commit is contained in:
tianyu 2015-07-22 12:32:46 +08:00
parent 867283fbc7
commit fe2ac78195
1 changed files with 16 additions and 3 deletions

View File

@ -1,10 +1,23 @@
#!/bin/bash
# pip install youtube-dl
URI=$1
export LC_ALL=en_US.UTF-8
AUDIO=$(youtube-dl -F $URI | grep "DASH audio"|grep "aac"|tail -1|cut -d ' ' -f 1)
VIDEO=$(youtube-dl -F $URI | grep "DASH video"|grep "mp4"|tail -1|cut -d ' ' -f 1)
youtube-dl -f $VIDEO+$AUDIO -k $URI
youtube-dl -v -f $VIDEO+$AUDIO -k $URI
NAME=$(echo "$URI" |cut -d '=' -f 2)
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
FILES=($(ls -- *$NAME*))
for FILE in "${FILES[@]}"; do
echo $FILE
done
IFS=$SAVEIFS