2017-05-18 22:51:33 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-06-06 21:17:36 +02:00
|
|
|
set -ex
|
|
|
|
|
2017-07-24 02:07:42 +02:00
|
|
|
if [ "$1" == "--help" ] || [[ -z "$1" ]]
|
|
|
|
then
|
2018-11-11 04:24:37 +01:00
|
|
|
echo "bash ./youtube-dl.sh URL FORMAT"
|
|
|
|
echo "Formate: [opus/m4a/video/hd/fullhd/4k]"
|
|
|
|
exit 0
|
2017-07-24 02:07:42 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
url="$1"
|
2018-05-30 20:30:37 +02:00
|
|
|
format="$2"
|
2017-05-18 22:51:33 +02:00
|
|
|
|
2017-05-31 13:16:28 +02:00
|
|
|
if [ "$format" == "opus" ]
|
2017-05-18 22:51:33 +02:00
|
|
|
then
|
2017-06-06 21:17:36 +02:00
|
|
|
format="-f 251"
|
2017-09-16 16:05:40 +02:00
|
|
|
elif [ "$format" == "m4a" ]
|
2017-05-31 13:16:28 +02:00
|
|
|
then
|
2017-06-06 21:17:36 +02:00
|
|
|
format="-f 140"
|
|
|
|
elif [ "$format" == "video" ]
|
|
|
|
then
|
|
|
|
format="-f 43"
|
2017-09-16 16:05:40 +02:00
|
|
|
elif [ "$format" == "hd" ]
|
|
|
|
then
|
|
|
|
format="-f 247+251"
|
2017-09-16 02:05:17 +02:00
|
|
|
elif [ "$format" == "fullhd" ]
|
2017-07-24 01:30:14 +02:00
|
|
|
then
|
|
|
|
format="-f 303+251"
|
2017-09-16 02:05:17 +02:00
|
|
|
elif [ "$format" == "4k" ]
|
|
|
|
then
|
|
|
|
format="-f 315+251"
|
2017-05-18 22:51:33 +02:00
|
|
|
fi
|
|
|
|
|
2017-09-24 19:39:14 +02:00
|
|
|
youtube-dl -i -c --socket-timeout 10000 --force-ipv4 --restrict-filenames $format $url
|