shell-scripte-code/youtube.sh

41 lines
769 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-07-24 01:30:14 +02:00
read -p "Soll ein Video heruntergeladen werden oder Audio? [opus/audio/video/BEST/4k] : " format
2017-06-06 21:17:36 +02:00
if [ "$format" == "opus" ]
then
format="-f 251"
elif [ "$format" == "audio" ]
then
format="-f 140"
elif [ "$format" == "video" ]
then
format="-f 43"
2017-07-24 01:30:14 +02:00
elif [ "$format" == "4k" ]
2017-07-15 08:19:35 +02:00
then
format="-f 303+251"
2017-06-06 21:17:36 +02:00
fi
2017-06-06 21:34:54 +02:00
if [ "$suche" == "suche" ]
then
2017-07-15 08:19:35 +02:00
youtube-dl "ytsearch:$wort" -q $format -o- | mplayer $voll -cache 8192 -
2017-06-06 21:34:54 +02:00
else
2017-07-15 08:19:35 +02:00
youtube-dl -q $format -o- $url | mplayer $voll -cache 8192 -
2017-06-06 21:34:54 +02:00
fi