[C] Change from youtube-dl to yt-dlp
This commit is contained in:
parent
2215cb1eb4
commit
bd91e25a76
1 changed files with 14 additions and 43 deletions
57
youtube.sh
57
youtube.sh
|
@ -4,68 +4,39 @@ set -ex
|
|||
|
||||
if [ "$1" == "--help" ] || [[ -z "$1" ]]
|
||||
then
|
||||
echo "bitte alles kleinschreiben"
|
||||
echo "bash ./youtube-dl.sh suche/search URL/stichwort FORMAT"
|
||||
echo "Formate: [opus/m4a/video/hd/hdmp4/fullhd/fullhdmp4/4k/FORMAT]"
|
||||
echo "bash ./youtube-dl.sh URL FORMAT"
|
||||
echo "Formate: [opus/m4a/video/hd/fullhd/4k]"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" == "suche" ] || [ "$1" == "search" ]; then
|
||||
suche="$1"
|
||||
url="$2"
|
||||
format="$3"
|
||||
else
|
||||
url="$1"
|
||||
format="$2"
|
||||
fi
|
||||
url="$1"
|
||||
format="$2"
|
||||
|
||||
if [ "$format" == "opus" ]
|
||||
then
|
||||
format="-f 251"
|
||||
format="--audio-format opus"
|
||||
audio="-x"
|
||||
quality="--audio-quality 0"
|
||||
elif [ "$format" == "m4a" ]
|
||||
then
|
||||
format="-f 140"
|
||||
format="--audio-format m4a"
|
||||
audio="-x"
|
||||
elif [ "$format" == "mp4" ]
|
||||
then
|
||||
format="--audio-format mp4"
|
||||
audio="-x"
|
||||
elif [ "$format" == "video" ]
|
||||
then
|
||||
format="-f 43"
|
||||
elif [ "$format" == "hd" ]
|
||||
then
|
||||
format="-f 247+251"
|
||||
elif [ "$format" == "hdmp4" ]
|
||||
then
|
||||
format="-f 22"
|
||||
elif [ "$format" == "fullhd" ]
|
||||
then
|
||||
format="-f 303+251"
|
||||
elif [ "$format" == "fullhdmp4" ]
|
||||
then
|
||||
format="-f 299+140"
|
||||
elif [ "$format" == "4k" ]
|
||||
then
|
||||
format="-f 315+251"
|
||||
elif [ -n "$format" ]; then
|
||||
format="-f $format"
|
||||
fi
|
||||
|
||||
video=""
|
||||
if [ "$suche" == "suche" ] || [ "$suche" == "search" ]
|
||||
then
|
||||
if ! youtube-dl "ytsearch:$url" -i -c --socket-timeout 10000 --force-ipv4 --restrict-filenames --no-playlist $format; then
|
||||
echo "Download fehlgeschlagen"
|
||||
exit 1
|
||||
fi
|
||||
video=$(youtube-dl "ytsearch:$url" -i -c --socket-timeout 10000 --force-ipv4 --restrict-filenames --no-playlist --get-filename $format)
|
||||
else
|
||||
if ! youtube-dl -i -c --socket-timeout 10000 --force-ipv4 --restrict-filenames --no-playlist $format $url; then
|
||||
echo "Download fehlgeschlagen"
|
||||
exit 1
|
||||
fi
|
||||
video=$(youtube-dl -i -c --socket-timeout 10000 --force-ipv4 --restrict-filenames --no-playlist --get-filename $format $url)
|
||||
fi
|
||||
|
||||
if [ "${video}" != "" ]; then
|
||||
vlc.exe ${video}
|
||||
else
|
||||
echo "Konnte Video nicht finden"
|
||||
exit 1
|
||||
fi
|
||||
yt-dlp -i -c --socket-timeout 10000 --force-ipv4 --restrict-filenames $format $audio $quality $url
|
||||
|
|
Loading…
Reference in a new issue