shell-scripte-code/youtube.sh

47 lines
912 B
Bash
Raw Normal View History

2017-06-06 21:17:36 +02:00
#!/bin/bash
set -ex
2017-06-06 21:34:54 +02:00
read -p "Haben sie eine url? : [URL/suche] " suche
if [ "$suche" == "suche" ]
then
read -p "Wie heißt das Stichwort? : " wort
else
2017-06-06 21:17:36 +02:00
read -p "Wie ist die URL? : " url
2017-06-06 21:34:54 +02:00
fi
2017-07-15 08:19:35 +02:00
read -p "Vollbild? : [Y/n] " vollbild
if [ "$vollbild" != "n" ]
then
voll="-fs"
fi
2017-09-23 17:10:53 +02:00
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-09-23 17:13:23 +02:00
youtube-dl "ytsearch:$wort" -q --force-ipv4 $format -o- | mplayer $voll -cache 8192 -
2017-06-06 21:34:54 +02:00
else
2017-09-23 17:10:53 +02:00
youtube-dl -q --force-ipv4 $format -o- $url | mplayer $voll -cache 8192 -
2017-06-06 21:34:54 +02:00
fi