2017-06-06 21:17:36 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
2017-09-23 17:30:59 +02:00
|
|
|
if [ "$1" == "--help" ] || [[ -z "$1" ]]
|
2017-06-06 21:34:54 +02:00
|
|
|
then
|
2017-11-17 21:24:15 +01:00
|
|
|
echo "bitte alles kleinschreiben"
|
|
|
|
echo "bash ./youtube-dl.sh suche/NOSUCHE URL/SUCHE FORMAT vollbild/NOVOLLBILD"
|
|
|
|
echo "Formate: [opus/m4a/video/hd/fullhd/4k]"
|
|
|
|
exit 0
|
2017-06-06 21:34:54 +02:00
|
|
|
fi
|
2017-07-15 08:19:35 +02:00
|
|
|
|
2017-11-17 21:24:15 +01:00
|
|
|
if [ "$1" == "suche" ] || [ "$1" == "nosuche" ]; then
|
|
|
|
suche="$1"
|
|
|
|
url="$2"
|
|
|
|
format="$3"
|
|
|
|
else
|
|
|
|
url="$1"
|
|
|
|
format="$2"
|
|
|
|
fi
|
2017-09-23 17:30:59 +02:00
|
|
|
|
|
|
|
if [ "$4" == "vollbild" ]
|
2017-07-15 08:19:35 +02:00
|
|
|
then
|
2017-11-17 21:24:15 +01:00
|
|
|
voll="-fs"
|
2017-07-15 08:19:35 +02:00
|
|
|
fi
|
|
|
|
|
2017-11-17 18:22:35 +01:00
|
|
|
#read -p "Wie ist die URL/suche? : " url
|
2017-09-23 17:30:59 +02:00
|
|
|
#read -p "Wo sollen die Dateien heruntergeladen werden? : " pfad
|
|
|
|
#read -p "Soll ein Video heruntergeladen werden oder Audio? [opus/m4a/video/hd/fullhd/4k] : " format
|
2017-06-06 21:17:36 +02:00
|
|
|
|
|
|
|
if [ "$format" == "opus" ]
|
|
|
|
then
|
|
|
|
format="-f 251"
|
2017-09-23 17:10:53 +02:00
|
|
|
elif [ "$format" == "m4a" ]
|
2017-06-06 21:17:36 +02:00
|
|
|
then
|
|
|
|
format="-f 140"
|
|
|
|
elif [ "$format" == "video" ]
|
|
|
|
then
|
|
|
|
format="-f 43"
|
2017-09-23 17:10:53 +02:00
|
|
|
elif [ "$format" == "hd" ]
|
|
|
|
then
|
|
|
|
format="-f 247+251"
|
|
|
|
elif [ "$format" == "fullhd" ]
|
2017-07-15 08:19:35 +02:00
|
|
|
then
|
|
|
|
format="-f 303+251"
|
2017-09-23 17:10:53 +02:00
|
|
|
elif [ "$format" == "4k" ]
|
|
|
|
then
|
|
|
|
format="-f 315+251"
|
2017-06-06 21:17:36 +02:00
|
|
|
fi
|
|
|
|
|
2017-06-06 21:34:54 +02:00
|
|
|
if [ "$suche" == "suche" ]
|
|
|
|
then
|
2017-11-17 21:24:15 +01:00
|
|
|
youtube-dl "ytsearch:$url" -q --force-ipv4 $format -o- | mplayer $voll -cache 8192 -
|
2017-06-06 21:34:54 +02:00
|
|
|
else
|
2017-11-17 21:24:15 +01:00
|
|
|
youtube-dl -q --force-ipv4 $format -o- $url | mplayer $voll -cache 8192 -
|
2017-06-06 21:34:54 +02:00
|
|
|
fi
|